@@ -42,21 +42,18 @@ describe('Admin can update plugin settings', () => {
42
42
43
43
it ( 'Admin can create a Signup form using Mailchimp block' , ( ) => {
44
44
const postTitle = 'Mailchimp signup form - Block' ;
45
- const beforeSave = ( ) => {
46
- cy . insertBlock ( 'mailchimp/mailchimp' , 'Mailchimp List Subscribe Form' ) ;
47
- cy . wait ( 500 ) ;
48
- } ;
49
- cy . createPost ( { title : postTitle , content : '' , beforeSave } ) . then ( ( postBlock ) => {
50
- if ( postBlock ) {
51
- blockPostPostURL = `/?p=${ postBlock . id } ` ;
52
- cy . visit ( blockPostPostURL ) ;
53
- cy . get ( '#mc_signup' ) . should ( 'exist' ) ;
54
- cy . get ( '#mc_mv_EMAIL' ) . should ( 'exist' ) ;
55
- cy . get ( '#mc_signup_submit' ) . should ( 'exist' ) ;
56
- cy . get ( '#mc_signup_submit' ) . click ( ) ;
57
- cy . get ( '.mc_error_msg' ) . should ( 'exist' ) ;
58
- cy . get ( '.mc_error_msg' ) . contains ( 'Email Address: This value should not be blank.' ) ;
59
- }
45
+ // Creating a post with Mailchimp block using wpCLI to test the backward compatibility of the existing block.
46
+ cy . wpCli (
47
+ `wp post create --post_title='${ postTitle } ' --post_content='<!-- wp:mailchimp/mailchimp -->' --post_status='publish' --porcelain` ,
48
+ ) . then ( ( response ) => {
49
+ blockPostPostURL = `/?p=${ response . stdout } ` ;
50
+ cy . visit ( blockPostPostURL ) ;
51
+ cy . get ( '#mc_signup' ) . should ( 'exist' ) ;
52
+ cy . get ( '#mc_mv_EMAIL' ) . should ( 'exist' ) ;
53
+ cy . get ( '#mc_signup_submit' ) . should ( 'exist' ) ;
54
+ cy . get ( '#mc_signup_submit' ) . click ( ) ;
55
+ cy . get ( '.mc_error_msg' ) . should ( 'exist' ) ;
56
+ cy . get ( '.mc_error_msg' ) . contains ( 'Email Address: This value should not be blank.' ) ;
60
57
} ) ;
61
58
} ) ;
62
59
@@ -82,95 +79,67 @@ describe('Admin can update plugin settings', () => {
82
79
} ) ;
83
80
} ) ;
84
81
85
- it ( 'Admin can remove mailchimp CSS ' , ( ) => {
82
+ it ( 'Admin can set Merge Fields Included settings ' , ( ) => {
86
83
// Remove mailchimp CSS.
87
84
cy . visit ( '/wp-admin/admin.php?page=mailchimp_sf_options' ) ;
88
- cy . get ( '#mc_nuke_all_styles' ) . check ( ) ;
89
- cy . get ( 'input[value="Update Subscribe Form Settings"]' ) . first ( ) . click ( ) ;
90
-
91
- // Verify
92
- [ shortcodePostURL , blockPostPostURL ] . forEach ( ( url ) => {
93
- cy . visit ( url ) ;
94
- cy . get ( '#mc_subheader' ) . should ( 'not.have.css' , 'margin-bottom' , '18px' ) ;
95
- } ) ;
96
-
97
- // Enable mailchimp CSS.
98
- cy . visit ( '/wp-admin/admin.php?page=mailchimp_sf_options' ) ;
99
- cy . get ( '#mc_nuke_all_styles' ) . uncheck ( ) ;
85
+ cy . get ( '#mc_mv_FNAME' ) . uncheck ( ) ;
86
+ cy . get ( '#mc_mv_LNAME' ) . uncheck ( ) ;
100
87
cy . get ( 'input[value="Update Subscribe Form Settings"]' ) . first ( ) . click ( ) ;
101
88
102
89
// Verify
103
90
[ shortcodePostURL , blockPostPostURL ] . forEach ( ( url ) => {
104
91
cy . visit ( url ) ;
105
- cy . get ( '#mc_subheader' ) . should ( 'have.css' , 'margin-bottom' , '18px' ) ;
92
+ cy . get ( '#mc_mv_FNAME' ) . should ( 'not.exist' ) ;
93
+ cy . get ( '#mc_mv_LNAME' ) . should ( 'not.exist' ) ;
106
94
} ) ;
107
- } ) ;
108
95
109
- it ( 'Admin can set custom styling on signup form' , ( ) => {
110
- // Enable custom styling and set values.
96
+ // Reset
111
97
cy . visit ( '/wp-admin/admin.php?page=mailchimp_sf_options' ) ;
112
- cy . get ( '#mc_custom_style' ) . check ( ) ;
113
- cy . get ( '#mc_form_border_width' ) . clear ( ) . type ( '10' ) ;
114
- cy . get ( '#mc_form_border_color' ) . clear ( ) . type ( '000000' ) ;
115
- cy . get ( '#mc_form_text_color' ) . clear ( ) . type ( 'FF0000' ) ;
116
- cy . get ( '#mc_form_background' ) . clear ( ) . type ( '00FF00' ) ;
98
+ cy . get ( '#mc_mv_FNAME' ) . check ( ) ;
99
+ cy . get ( '#mc_mv_LNAME' ) . check ( ) ;
117
100
cy . get ( 'input[value="Update Subscribe Form Settings"]' ) . first ( ) . click ( ) ;
118
101
119
102
// Verify
120
103
[ shortcodePostURL , blockPostPostURL ] . forEach ( ( url ) => {
121
104
cy . visit ( url ) ;
122
- cy . get ( '#mc_signup form' ) . should ( 'have.css' , 'border-width' , '10px' ) ;
123
- cy . get ( '#mc_signup form' ) . should ( 'have.css' , 'border-color' , 'rgb(0, 0, 0)' ) ;
124
- cy . get ( '#mc_signup form' ) . should ( 'have.css' , 'color' , 'rgb(255, 0, 0)' ) ;
125
- cy . get ( '#mc_signup form' ) . should ( 'have.css' , 'background-color' , 'rgb(0, 255, 0)' ) ;
105
+ cy . get ( '#mc_mv_FNAME' ) . should ( 'exist' ) ;
106
+ cy . get ( '#mc_mv_LNAME' ) . should ( 'exist' ) ;
126
107
} ) ;
127
-
128
- // Reset
129
- cy . visit ( '/wp-admin/admin.php?page=mailchimp_sf_options' ) ;
130
- cy . get ( '#mc_custom_style' ) . uncheck ( ) ;
131
- cy . get ( 'input[value="Update Subscribe Form Settings"]' ) . first ( ) . click ( ) ;
132
108
} ) ;
133
109
134
- it ( 'Admin can set Merge Fields Included settings' , ( ) => {
135
- // Remove mailchimp CSS.
110
+ it ( 'Admin can update groups settings' , ( ) => {
136
111
cy . visit ( '/wp-admin/admin.php?page=mailchimp_sf_options' ) ;
137
- cy . get ( '#mc_mv_FNAME' ) . uncheck ( ) ;
138
- cy . get ( '#mc_mv_LNAME' ) . uncheck ( ) ;
112
+ cy . get ( 'input[id^="mc_show_interest_groups_"]' ) . check ( ) ;
139
113
cy . get ( 'input[value="Update Subscribe Form Settings"]' ) . first ( ) . click ( ) ;
140
114
141
115
// Verify
142
116
[ shortcodePostURL , blockPostPostURL ] . forEach ( ( url ) => {
143
117
cy . visit ( url ) ;
144
- cy . get ( '#mc_mv_FNAME ' ) . should ( 'not. exist' ) ;
145
- cy . get ( '#mc_mv_LNAME ' ) . should ( 'not. exist' ) ;
118
+ cy . get ( '.mc_interests_header ' ) . should ( 'exist' ) ;
119
+ cy . get ( '.mc_interest ' ) . should ( 'exist' ) ;
146
120
} ) ;
147
121
148
122
// Reset
149
123
cy . visit ( '/wp-admin/admin.php?page=mailchimp_sf_options' ) ;
150
- cy . get ( '#mc_mv_FNAME' ) . check ( ) ;
151
- cy . get ( '#mc_mv_LNAME' ) . check ( ) ;
124
+ cy . get ( 'input[id^="mc_show_interest_groups_"]' ) . uncheck ( ) ;
152
125
cy . get ( 'input[value="Update Subscribe Form Settings"]' ) . first ( ) . click ( ) ;
153
126
154
- // Verify
155
127
[ shortcodePostURL , blockPostPostURL ] . forEach ( ( url ) => {
156
128
cy . visit ( url ) ;
157
- cy . get ( '#mc_mv_FNAME ' ) . should ( 'exist' ) ;
158
- cy . get ( '#mc_mv_LNAME ' ) . should ( 'exist' ) ;
129
+ cy . get ( '.mc_interests_header ' ) . should ( 'not. exist' ) ;
130
+ cy . get ( '.mc_interest ' ) . should ( 'not. exist' ) ;
159
131
} ) ;
160
132
} ) ;
161
133
162
134
it ( 'Admin can set list options settings' , ( ) => {
163
- // Remove mailchimp CSS .
135
+ // display unsubscribe link .
164
136
cy . visit ( '/wp-admin/admin.php?page=mailchimp_sf_options' ) ;
165
137
cy . get ( '#mc_use_unsub_link' ) . check ( ) ;
166
138
cy . get ( 'input[value="Update Subscribe Form Settings"]' ) . first ( ) . click ( ) ;
167
139
168
140
// Verify
169
141
[ shortcodePostURL , blockPostPostURL ] . forEach ( ( url ) => {
170
142
cy . visit ( url ) ;
171
- cy . get ( '#mc_mv_BIRTHDAY' ) . should ( 'not.have.class' , 'hasDatepicker' ) ;
172
- cy . get ( '#mc_mv_BIRTHDAY' ) . click ( ) ;
173
- cy . get ( '#ui-datepicker-div' ) . should ( 'not.exist' ) ;
174
143
cy . get ( '#mc_unsub_link' ) . should ( 'exist' ) ;
175
144
} ) ;
176
145
@@ -181,19 +150,7 @@ describe('Admin can update plugin settings', () => {
181
150
182
151
[ shortcodePostURL , blockPostPostURL ] . forEach ( ( url ) => {
183
152
cy . visit ( url ) ;
184
- cy . get ( '#mc_mv_BIRTHDAY' ) . should ( 'have.class' , 'hasDatepicker' ) ;
185
- cy . get ( '#mc_mv_BIRTHDAY' ) . click ( ) ;
186
- cy . get ( '#ui-datepicker-div' ) . should ( 'exist' ) ;
187
153
cy . get ( '#mc_unsub_link' ) . should ( 'not.exist' ) ;
188
154
} ) ;
189
155
} ) ;
190
-
191
- it ( 'Admin can logout' , ( ) => {
192
- cy . visit ( '/wp-admin/admin.php?page=mailchimp_sf_options' ) ;
193
- cy . get ( '#mailchimp_sf_oauth_connect' ) . should ( 'not.exist' ) ;
194
- cy . get ( 'input[value="Logout"]' ) . click ( ) ;
195
-
196
- // connect to "Mailchimp" Account button should be visible.
197
- cy . get ( '#mailchimp_sf_oauth_connect' ) . should ( 'exist' ) ;
198
- } ) ;
199
156
} ) ;
0 commit comments