@@ -70,15 +70,12 @@ describe('Admin can update plugin settings', () => {
70
70
cy . get ( 'input[value="Update Subscribe Form Settings"]' ) . first ( ) . click ( ) ;
71
71
72
72
// Verify content options
73
- cy . visit ( `/?p=${ shortcodePostId } ` ) ;
74
- cy . get ( '.mc_custom_border_hdr' ) . contains ( header ) ;
75
- cy . get ( '#mc_subheader' ) . contains ( subHeader ) ;
76
- cy . get ( '#mc_signup_submit' ) . contains ( button ) ;
77
-
78
- cy . visit ( `/?p=${ blockPostId } ` ) ;
79
- cy . get ( '.mc_custom_border_hdr' ) . contains ( header ) ;
80
- cy . get ( '#mc_subheader' ) . contains ( subHeader ) ;
81
- cy . get ( '#mc_signup_submit' ) . contains ( button ) ;
73
+ [ shortcodePostId , blockPostId ] . forEach ( ( postId ) => {
74
+ cy . visit ( `/?p=${ postId } ` ) ;
75
+ cy . get ( '.mc_custom_border_hdr' ) . contains ( header ) ;
76
+ cy . get ( '#mc_subheader' ) . contains ( subHeader ) ;
77
+ cy . get ( '#mc_signup_submit' ) . contains ( button ) ;
78
+ } ) ;
82
79
} ) ;
83
80
84
81
it ( 'Admin can remove mailchimp CSS' , ( ) => {
@@ -88,27 +85,25 @@ describe('Admin can update plugin settings', () => {
88
85
cy . get ( 'input[value="Update Subscribe Form Settings"]' ) . first ( ) . click ( ) ;
89
86
90
87
// Verify
91
- cy . visit ( `/?p=${ shortcodePostId } ` ) ;
92
- cy . get ( '#mc_subheader' ) . should ( 'not.have.css' , 'margin-bottom' , '18px' ) ;
93
-
94
- cy . visit ( `/?p=${ blockPostId } ` ) ;
95
- cy . get ( '#mc_subheader' ) . should ( 'not.have.css' , 'margin-bottom' , '18px' ) ;
88
+ [ shortcodePostId , blockPostId ] . forEach ( ( postId ) => {
89
+ cy . visit ( `/?p=${ postId } ` ) ;
90
+ cy . get ( '#mc_subheader' ) . should ( 'not.have.css' , 'margin-bottom' , '18px' ) ;
91
+ } ) ;
96
92
97
93
// Enable mailchimp CSS.
98
94
cy . visit ( '/wp-admin/admin.php?page=mailchimp_sf_options' ) ;
99
95
cy . get ( '#mc_nuke_all_styles' ) . uncheck ( ) ;
100
96
cy . get ( 'input[value="Update Subscribe Form Settings"]' ) . first ( ) . click ( ) ;
101
97
102
98
// Verify
103
- cy . visit ( `/?p=${ shortcodePostId } ` ) ;
104
- cy . get ( '#mc_subheader' ) . should ( 'have.css' , 'margin-bottom' , '18px' ) ;
105
-
106
- cy . visit ( `/?p=${ blockPostId } ` ) ;
107
- cy . get ( '#mc_subheader' ) . should ( 'have.css' , 'margin-bottom' , '18px' ) ;
99
+ [ shortcodePostId , blockPostId ] . forEach ( ( postId ) => {
100
+ cy . visit ( `/?p=${ postId } ` ) ;
101
+ cy . get ( '#mc_subheader' ) . should ( 'have.css' , 'margin-bottom' , '18px' ) ;
102
+ } ) ;
108
103
} ) ;
109
104
110
105
it ( 'Admin can set custom styling on signup form' , ( ) => {
111
- // Remove mailchimp CSS .
106
+ // Enable custom styling and set values .
112
107
cy . visit ( '/wp-admin/admin.php?page=mailchimp_sf_options' ) ;
113
108
cy . get ( '#mc_custom_style' ) . check ( ) ;
114
109
cy . get ( '#mc_form_border_width' ) . clear ( ) . type ( '10' ) ;
@@ -118,21 +113,80 @@ describe('Admin can update plugin settings', () => {
118
113
cy . get ( 'input[value="Update Subscribe Form Settings"]' ) . first ( ) . click ( ) ;
119
114
120
115
// Verify
121
- cy . visit ( `/?p=${ shortcodePostId } ` ) ;
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)' ) ;
126
-
127
- cy . visit ( `/?p=${ blockPostId } ` ) ;
128
- cy . get ( '#mc_signup form' ) . should ( 'have.css' , 'border-width' , '10px' ) ;
129
- cy . get ( '#mc_signup form' ) . should ( 'have.css' , 'border-color' , 'rgb(0, 0, 0)' ) ;
130
- cy . get ( '#mc_signup form' ) . should ( 'have.css' , 'color' , 'rgb(255, 0, 0)' ) ;
131
- cy . get ( '#mc_signup form' ) . should ( 'have.css' , 'background-color' , 'rgb(0, 255, 0)' ) ;
116
+ [ shortcodePostId , blockPostId ] . forEach ( ( postId ) => {
117
+ cy . visit ( `/?p=${ postId } ` ) ;
118
+ cy . get ( '#mc_signup form' ) . should ( 'have.css' , 'border-width' , '10px' ) ;
119
+ cy . get ( '#mc_signup form' ) . should ( 'have.css' , 'border-color' , 'rgb(0, 0, 0)' ) ;
120
+ cy . get ( '#mc_signup form' ) . should ( 'have.css' , 'color' , 'rgb(255, 0, 0)' ) ;
121
+ cy . get ( '#mc_signup form' ) . should ( 'have.css' , 'background-color' , 'rgb(0, 255, 0)' ) ;
122
+ } ) ;
132
123
133
- // Enable mailchimp CSS.
124
+ // Reset
134
125
cy . visit ( '/wp-admin/admin.php?page=mailchimp_sf_options' ) ;
135
126
cy . get ( '#mc_custom_style' ) . uncheck ( ) ;
136
127
cy . get ( 'input[value="Update Subscribe Form Settings"]' ) . first ( ) . click ( ) ;
137
128
} ) ;
129
+
130
+ it ( 'Admin can set Merge Fields Included settings' , ( ) => {
131
+ // Remove mailchimp CSS.
132
+ cy . visit ( '/wp-admin/admin.php?page=mailchimp_sf_options' ) ;
133
+ cy . get ( '#mc_mv_FNAME' ) . uncheck ( ) ;
134
+ cy . get ( '#mc_mv_LNAME' ) . uncheck ( ) ;
135
+ cy . get ( 'input[value="Update Subscribe Form Settings"]' ) . first ( ) . click ( ) ;
136
+
137
+ // Verify
138
+ [ shortcodePostId , blockPostId ] . forEach ( ( postId ) => {
139
+ cy . visit ( `/?p=${ postId } ` ) ;
140
+ cy . get ( '#mc_mv_FNAME' ) . should ( 'not.exist' ) ;
141
+ cy . get ( '#mc_mv_LNAME' ) . should ( 'not.exist' ) ;
142
+ } ) ;
143
+
144
+ // Reset
145
+ cy . visit ( '/wp-admin/admin.php?page=mailchimp_sf_options' ) ;
146
+ cy . get ( '#mc_mv_FNAME' ) . check ( ) ;
147
+ cy . get ( '#mc_mv_LNAME' ) . check ( ) ;
148
+ cy . get ( 'input[value="Update Subscribe Form Settings"]' ) . first ( ) . click ( ) ;
149
+
150
+ // Verify
151
+ [ shortcodePostId , blockPostId ] . forEach ( ( postId ) => {
152
+ cy . visit ( `/?p=${ postId } ` ) ;
153
+ cy . get ( '#mc_mv_FNAME' ) . should ( 'exist' ) ;
154
+ cy . get ( '#mc_mv_LNAME' ) . should ( 'exist' ) ;
155
+ } ) ;
156
+ } ) ;
157
+
158
+ it ( 'Admin can set list options settings' , ( ) => {
159
+ // Remove mailchimp CSS.
160
+ cy . visit ( '/wp-admin/admin.php?page=mailchimp_sf_options' ) ;
161
+ cy . get ( '#mc_use_javascript' ) . uncheck ( ) ;
162
+ cy . get ( '#mc_use_datepicker' ) . uncheck ( ) ;
163
+ cy . get ( '#mc_use_unsub_link' ) . check ( ) ;
164
+ cy . get ( 'input[value="Update Subscribe Form Settings"]' ) . first ( ) . click ( ) ;
165
+
166
+ // Verify
167
+ [ shortcodePostId , blockPostId ] . forEach ( ( postId ) => {
168
+ cy . visit ( `/?p=${ postId } ` ) ;
169
+ cy . get ( '#mc_submit_type' ) . should ( 'have.value' , 'html' ) ;
170
+ cy . get ( '#mc_mv_BIRTHDAY' ) . should ( 'not.have.class' , 'hasDatepicker' ) ;
171
+ cy . get ( '#mc_mv_BIRTHDAY' ) . click ( ) ;
172
+ cy . get ( '#ui-datepicker-div' ) . should ( 'not.exist' ) ;
173
+ cy . get ( '#mc_unsub_link' ) . should ( 'exist' ) ;
174
+ } ) ;
175
+
176
+ // Reset
177
+ cy . visit ( '/wp-admin/admin.php?page=mailchimp_sf_options' ) ;
178
+ cy . get ( '#mc_use_javascript' ) . check ( ) ;
179
+ cy . get ( '#mc_use_datepicker' ) . check ( ) ;
180
+ cy . get ( '#mc_use_unsub_link' ) . uncheck ( ) ;
181
+ cy . get ( 'input[value="Update Subscribe Form Settings"]' ) . first ( ) . click ( ) ;
182
+
183
+ [ shortcodePostId , blockPostId ] . forEach ( ( postId ) => {
184
+ cy . visit ( `/?p=${ postId } ` ) ;
185
+ cy . get ( '#mc_submit_type' ) . should ( 'have.value' , 'js' ) ;
186
+ cy . get ( '#mc_mv_BIRTHDAY' ) . should ( 'have.class' , 'hasDatepicker' ) ;
187
+ cy . get ( '#mc_mv_BIRTHDAY' ) . click ( ) ;
188
+ cy . get ( '#ui-datepicker-div' ) . should ( 'exist' ) ;
189
+ cy . get ( '#mc_unsub_link' ) . should ( 'not.exist' ) ;
190
+ } ) ;
191
+ } ) ;
138
192
} ) ;
0 commit comments