@@ -246,6 +246,37 @@ describe('Block Tests', () => {
246246 } ) ;
247247 } ) ;
248248
249+ it ( 'Proper error message should display if unsubscribed user try to subscribe' , ( ) => {
250+ cy . visit ( `/wp-admin/post.php?post=${ postId } &action=edit` ) ;
251+ cy . getBlockEditor ( ) . find ( 'h2[aria-label="Enter a header (optional)"]' ) . click ( ) ;
252+ cy . openDocumentSettingsPanel ( 'Form Settings' , 'Block' ) ;
253+ cy . get ( '.mailchimp-double-opt-in input.components-form-toggle__input' ) . first ( ) . uncheck ( ) ;
254+ cy . get ( '.mailchimp-update-existing-subscribers input.components-form-toggle__input' )
255+ . first ( )
256+ . check ( ) ;
257+ cy . get ( 'button.editor-post-publish-button' ) . click ( ) ;
258+ cy . wait ( 500 ) ;
259+
260+ // Verify
261+ cy . visit ( `/?p=${ postId } ` ) ;
262+ cy . get ( '#mc_mv_EMAIL' ) . should ( 'exist' ) ;
263+ cy . get ( '#mc_mv_EMAIL' ) . clear ( ) . type ( 'unsubscribed_user@gmail.com' ) ;
264+ cy . get ( '#mc_signup_submit' ) . should ( 'exist' ) ;
265+ cy . get ( '#mc_signup_submit' ) . click ( ) ;
266+ cy . get ( '.mc_error_msg' ) . should ( 'exist' ) ;
267+ cy . get ( '.mc_error_msg' ) . contains (
268+ 'The email address cannot be subscribed because it was previously unsubscribed, bounced, or is under review. Please sign up here.' ,
269+ ) ;
270+
271+ // Reset
272+ cy . visit ( `/wp-admin/post.php?post=${ postId } &action=edit` ) ;
273+ cy . getBlockEditor ( ) . find ( 'h2[aria-label="Enter a header (optional)"]' ) . click ( ) ;
274+ cy . openDocumentSettingsPanel ( 'Form Settings' , 'Block' ) ;
275+ cy . get ( '.mailchimp-double-opt-in input.components-form-toggle__input' ) . first ( ) . check ( ) ;
276+ cy . get ( 'button.editor-post-publish-button' ) . click ( ) ;
277+ cy . wait ( 500 ) ;
278+ } ) ;
279+
249280 it ( 'Form data should persist if validation fails' , ( ) => {
250281 // Verify
251282 const firstName = 'John' ;
0 commit comments