1
1
/* eslint-disable no-undef */
2
2
describe ( 'Admin can update plugin settings' , ( ) => {
3
- let shortcodePostId = 0 ;
4
- let blockPostId = 0 ;
3
+ let shortcodePostURL = '/mailchimp-signup-form-shortcode' ;
4
+ let blockPostPostURL = '/mailchimp-signup-form-block' ;
5
5
6
6
before ( ( ) => {
7
7
cy . login ( ) ;
@@ -25,8 +25,8 @@ describe('Admin can update plugin settings', () => {
25
25
} ;
26
26
cy . createPost ( { title : postTitle , content : '' , beforeSave } ) . then ( ( post ) => {
27
27
if ( post ) {
28
- shortcodePostId = post . id ;
29
- cy . visit ( `/?p= ${ shortcodePostId } ` ) ;
28
+ shortcodePostURL = `/?p= ${ post . id } ` ;
29
+ cy . visit ( shortcodePostURL ) ;
30
30
cy . get ( '#mc_signup' ) . should ( 'exist' ) ;
31
31
cy . get ( '#mc_mv_EMAIL' ) . should ( 'exist' ) ;
32
32
cy . get ( '#mc_signup_submit' ) . should ( 'exist' ) ;
@@ -42,10 +42,10 @@ describe('Admin can update plugin settings', () => {
42
42
const beforeSave = ( ) => {
43
43
cy . insertBlock ( 'mailchimp/mailchimp' , 'Mailchimp List Subscribe Form' ) ;
44
44
} ;
45
- cy . createPost ( { title : postTitle , content : '' , beforeSave } ) . then ( ( post ) => {
46
- if ( post ) {
47
- blockPostId = post . id ;
48
- cy . visit ( `/?p= ${ shortcodePostId } ` ) ;
45
+ cy . createPost ( { title : postTitle , content : '' , beforeSave } ) . then ( ( postBlock ) => {
46
+ if ( postBlock ) {
47
+ blockPostPostURL = `/?p= ${ postBlock . id } ` ;
48
+ cy . visit ( blockPostPostURL ) ;
49
49
cy . get ( '#mc_signup' ) . should ( 'exist' ) ;
50
50
cy . get ( '#mc_mv_EMAIL' ) . should ( 'exist' ) ;
51
51
cy . get ( '#mc_signup_submit' ) . should ( 'exist' ) ;
@@ -70,8 +70,8 @@ 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
- [ shortcodePostId , blockPostId ] . forEach ( ( postId ) => {
74
- cy . visit ( `/?p= ${ postId } ` ) ;
73
+ [ shortcodePostURL , blockPostPostURL ] . forEach ( ( url ) => {
74
+ cy . visit ( url ) ;
75
75
cy . get ( '.mc_custom_border_hdr' ) . contains ( header ) ;
76
76
cy . get ( '#mc_subheader' ) . contains ( subHeader ) ;
77
77
cy . get ( '#mc_signup_submit' ) . contains ( button ) ;
@@ -85,8 +85,8 @@ describe('Admin can update plugin settings', () => {
85
85
cy . get ( 'input[value="Update Subscribe Form Settings"]' ) . first ( ) . click ( ) ;
86
86
87
87
// Verify
88
- [ shortcodePostId , blockPostId ] . forEach ( ( postId ) => {
89
- cy . visit ( `/?p= ${ postId } ` ) ;
88
+ [ shortcodePostURL , blockPostPostURL ] . forEach ( ( url ) => {
89
+ cy . visit ( url ) ;
90
90
cy . get ( '#mc_subheader' ) . should ( 'not.have.css' , 'margin-bottom' , '18px' ) ;
91
91
} ) ;
92
92
@@ -96,8 +96,8 @@ describe('Admin can update plugin settings', () => {
96
96
cy . get ( 'input[value="Update Subscribe Form Settings"]' ) . first ( ) . click ( ) ;
97
97
98
98
// Verify
99
- [ shortcodePostId , blockPostId ] . forEach ( ( postId ) => {
100
- cy . visit ( `/?p= ${ postId } ` ) ;
99
+ [ shortcodePostURL , blockPostPostURL ] . forEach ( ( url ) => {
100
+ cy . visit ( url ) ;
101
101
cy . get ( '#mc_subheader' ) . should ( 'have.css' , 'margin-bottom' , '18px' ) ;
102
102
} ) ;
103
103
} ) ;
@@ -113,8 +113,8 @@ describe('Admin can update plugin settings', () => {
113
113
cy . get ( 'input[value="Update Subscribe Form Settings"]' ) . first ( ) . click ( ) ;
114
114
115
115
// Verify
116
- [ shortcodePostId , blockPostId ] . forEach ( ( postId ) => {
117
- cy . visit ( `/?p= ${ postId } ` ) ;
116
+ [ shortcodePostURL , blockPostPostURL ] . forEach ( ( url ) => {
117
+ cy . visit ( url ) ;
118
118
cy . get ( '#mc_signup form' ) . should ( 'have.css' , 'border-width' , '10px' ) ;
119
119
cy . get ( '#mc_signup form' ) . should ( 'have.css' , 'border-color' , 'rgb(0, 0, 0)' ) ;
120
120
cy . get ( '#mc_signup form' ) . should ( 'have.css' , 'color' , 'rgb(255, 0, 0)' ) ;
@@ -135,8 +135,8 @@ describe('Admin can update plugin settings', () => {
135
135
cy . get ( 'input[value="Update Subscribe Form Settings"]' ) . first ( ) . click ( ) ;
136
136
137
137
// Verify
138
- [ shortcodePostId , blockPostId ] . forEach ( ( postId ) => {
139
- cy . visit ( `/?p= ${ postId } ` ) ;
138
+ [ shortcodePostURL , blockPostPostURL ] . forEach ( ( url ) => {
139
+ cy . visit ( url ) ;
140
140
cy . get ( '#mc_mv_FNAME' ) . should ( 'not.exist' ) ;
141
141
cy . get ( '#mc_mv_LNAME' ) . should ( 'not.exist' ) ;
142
142
} ) ;
@@ -148,8 +148,8 @@ describe('Admin can update plugin settings', () => {
148
148
cy . get ( 'input[value="Update Subscribe Form Settings"]' ) . first ( ) . click ( ) ;
149
149
150
150
// Verify
151
- [ shortcodePostId , blockPostId ] . forEach ( ( postId ) => {
152
- cy . visit ( `/?p= ${ postId } ` ) ;
151
+ [ shortcodePostURL , blockPostPostURL ] . forEach ( ( url ) => {
152
+ cy . visit ( url ) ;
153
153
cy . get ( '#mc_mv_FNAME' ) . should ( 'exist' ) ;
154
154
cy . get ( '#mc_mv_LNAME' ) . should ( 'exist' ) ;
155
155
} ) ;
@@ -164,8 +164,8 @@ describe('Admin can update plugin settings', () => {
164
164
cy . get ( 'input[value="Update Subscribe Form Settings"]' ) . first ( ) . click ( ) ;
165
165
166
166
// Verify
167
- [ shortcodePostId , blockPostId ] . forEach ( ( postId ) => {
168
- cy . visit ( `/?p= ${ postId } ` ) ;
167
+ [ shortcodePostURL , blockPostPostURL ] . forEach ( ( url ) => {
168
+ cy . visit ( url ) ;
169
169
cy . get ( '#mc_submit_type' ) . should ( 'have.value' , 'html' ) ;
170
170
cy . get ( '#mc_mv_BIRTHDAY' ) . should ( 'not.have.class' , 'hasDatepicker' ) ;
171
171
cy . get ( '#mc_mv_BIRTHDAY' ) . click ( ) ;
@@ -180,8 +180,8 @@ describe('Admin can update plugin settings', () => {
180
180
cy . get ( '#mc_use_unsub_link' ) . uncheck ( ) ;
181
181
cy . get ( 'input[value="Update Subscribe Form Settings"]' ) . first ( ) . click ( ) ;
182
182
183
- [ shortcodePostId , blockPostId ] . forEach ( ( postId ) => {
184
- cy . visit ( `/?p= ${ postId } ` ) ;
183
+ [ shortcodePostURL , blockPostPostURL ] . forEach ( ( url ) => {
184
+ cy . visit ( url ) ;
185
185
cy . get ( '#mc_submit_type' ) . should ( 'have.value' , 'js' ) ;
186
186
cy . get ( '#mc_mv_BIRTHDAY' ) . should ( 'have.class' , 'hasDatepicker' ) ;
187
187
cy . get ( '#mc_mv_BIRTHDAY' ) . click ( ) ;
0 commit comments