File tree Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -246,6 +246,29 @@ describe('Block Tests', () => {
246
246
} ) ;
247
247
} ) ;
248
248
249
+ it ( 'Spam protection should work as expected' , ( ) => {
250
+ // Show error message to spam bots.
251
+ cy . visit ( `/?p=${ postId } ` ) ;
252
+ cy . get ( '#mc_signup' ) . should ( 'exist' ) ;
253
+ cy . get ( 'input[name="mailchimp_sf_alt_email"]' ) . then ( ( el ) => {
254
+ el . val ( '123' ) ;
255
+ } ) ;
256
+ cy . get ( '#mc_signup_submit' ) . should ( 'exist' ) ;
257
+ cy . get ( '#mc_signup_submit' ) . click ( ) ;
258
+ cy . get ( '.mc_error_msg' ) . should ( 'exist' ) ;
259
+ cy . get ( '.mc_error_msg' ) . contains (
260
+ "We couldn't process your submission as it was flagged as potential spam" ,
261
+ ) ;
262
+
263
+ // Normal user should not see the error message.
264
+ cy . visit ( `/?p=${ postId } ` ) ;
265
+ cy . get ( '#mc_signup' ) . should ( 'exist' ) ;
266
+ cy . get ( '#mc_signup_submit' ) . should ( 'exist' ) ;
267
+ cy . get ( '#mc_signup_submit' ) . click ( ) ;
268
+ cy . get ( '.mc_error_msg' ) . should ( 'exist' ) ;
269
+ cy . get ( '.mc_error_msg' ) . contains ( 'Email Address: This value should not be blank.' ) ;
270
+ } ) ;
271
+
249
272
// TODO: Add tests for the Double Opt-in and Update existing subscribers settings.
250
273
// TODO: Add tests for the block styles settings.
251
274
// TODO: Add tests for the form submission.
Original file line number Diff line number Diff line change @@ -153,4 +153,27 @@ describe('Admin can update plugin settings', () => {
153
153
cy . get ( '#mc_unsub_link' ) . should ( 'not.exist' ) ;
154
154
} ) ;
155
155
} ) ;
156
+
157
+ it ( 'Spam protection should work as expected' , ( ) => {
158
+ // Show error message to spam bots.
159
+ cy . visit ( shortcodePostURL ) ;
160
+ cy . get ( '#mc_signup' ) . should ( 'exist' ) ;
161
+ cy . get ( 'input[name="mailchimp_sf_alt_email"]' ) . then ( ( el ) => {
162
+ el . val ( '123' ) ;
163
+ } ) ;
164
+ cy . get ( '#mc_signup_submit' ) . should ( 'exist' ) ;
165
+ cy . get ( '#mc_signup_submit' ) . click ( ) ;
166
+ cy . get ( '.mc_error_msg' ) . should ( 'exist' ) ;
167
+ cy . get ( '.mc_error_msg' ) . contains (
168
+ "We couldn't process your submission as it was flagged as potential spam" ,
169
+ ) ;
170
+
171
+ // Normal user should not see the error message.
172
+ cy . visit ( shortcodePostURL ) ;
173
+ cy . get ( '#mc_signup' ) . should ( 'exist' ) ;
174
+ cy . get ( '#mc_signup_submit' ) . should ( 'exist' ) ;
175
+ cy . get ( '#mc_signup_submit' ) . click ( ) ;
176
+ cy . get ( '.mc_error_msg' ) . should ( 'exist' ) ;
177
+ cy . get ( '.mc_error_msg' ) . contains ( 'Email Address: This value should not be blank.' ) ;
178
+ } ) ;
156
179
} ) ;
You can’t perform that action at this time.
0 commit comments