File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -194,6 +194,29 @@ describe('Admin can update plugin settings', () => {
194
194
} ) ;
195
195
} ) ;
196
196
197
+ it ( 'Form data should persist if validation fails' , ( ) => {
198
+ // Remove mailchimp CSS.
199
+ cy . visit ( '/wp-admin/admin.php?page=mailchimp_sf_options' ) ;
200
+ cy . get ( '#mc_use_javascript' ) . check ( ) ;
201
+ cy . get ( 'input[value="Update Subscribe Form Settings"]' ) . first ( ) . click ( ) ;
202
+
203
+ // Verify
204
+ [ shortcodePostURL , blockPostPostURL ] . forEach ( ( url ) => {
205
+ const firstName = 'John' ;
206
+ const lastName = 'Doe' ;
207
+ cy . visit ( url ) ;
208
+ cy . get ( '#mc_mv_EMAIL' ) . should ( 'exist' ) ;
209
+ cy . get ( '#mc_mv_FNAME' ) . clear ( ) . type ( firstName ) ;
210
+ cy . get ( '#mc_mv_LNAME' ) . clear ( ) . type ( lastName ) ;
211
+ cy . get ( '#mc_signup_submit' ) . should ( 'exist' ) ;
212
+ cy . get ( '#mc_signup_submit' ) . click ( ) ;
213
+ cy . get ( '.mc_error_msg' ) . should ( 'exist' ) ;
214
+ cy . get ( '.mc_error_msg' ) . contains ( 'Email Address: This value should not be blank.' ) ;
215
+ cy . get ( '#mc_mv_FNAME' ) . should ( 'have.value' , firstName ) ;
216
+ cy . get ( '#mc_mv_LNAME' ) . should ( 'have.value' , lastName ) ;
217
+ } ) ;
218
+ } ) ;
219
+
197
220
it ( 'Admin can logout' , ( ) => {
198
221
cy . visit ( '/wp-admin/admin.php?page=mailchimp_sf_options' ) ;
199
222
cy . get ( '#mailchimp_sf_oauth_connect' ) . should ( 'not.exist' ) ;
You can’t perform that action at this time.
0 commit comments