Skip to content

Commit c633d39

Browse files
committed
Some improvements in settings tests.
1 parent ab923bd commit c633d39

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

tests/cypress/e2e/settings.test.js

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable no-undef */
22
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';
55

66
before(() => {
77
cy.login();
@@ -25,8 +25,8 @@ describe('Admin can update plugin settings', () => {
2525
};
2626
cy.createPost({ title: postTitle, content: '', beforeSave }).then((post) => {
2727
if (post) {
28-
shortcodePostId = post.id;
29-
cy.visit(`/?p=${shortcodePostId}`);
28+
shortcodePostURL = `/?p=${post.id}`;
29+
cy.visit(shortcodePostURL);
3030
cy.get('#mc_signup').should('exist');
3131
cy.get('#mc_mv_EMAIL').should('exist');
3232
cy.get('#mc_signup_submit').should('exist');
@@ -42,10 +42,10 @@ describe('Admin can update plugin settings', () => {
4242
const beforeSave = () => {
4343
cy.insertBlock('mailchimp/mailchimp', 'Mailchimp List Subscribe Form');
4444
};
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);
4949
cy.get('#mc_signup').should('exist');
5050
cy.get('#mc_mv_EMAIL').should('exist');
5151
cy.get('#mc_signup_submit').should('exist');
@@ -70,8 +70,8 @@ describe('Admin can update plugin settings', () => {
7070
cy.get('input[value="Update Subscribe Form Settings"]').first().click();
7171

7272
// Verify content options
73-
[shortcodePostId, blockPostId].forEach((postId) => {
74-
cy.visit(`/?p=${postId}`);
73+
[shortcodePostURL, blockPostPostURL].forEach((url) => {
74+
cy.visit(url);
7575
cy.get('.mc_custom_border_hdr').contains(header);
7676
cy.get('#mc_subheader').contains(subHeader);
7777
cy.get('#mc_signup_submit').contains(button);
@@ -85,8 +85,8 @@ describe('Admin can update plugin settings', () => {
8585
cy.get('input[value="Update Subscribe Form Settings"]').first().click();
8686

8787
// Verify
88-
[shortcodePostId, blockPostId].forEach((postId) => {
89-
cy.visit(`/?p=${postId}`);
88+
[shortcodePostURL, blockPostPostURL].forEach((url) => {
89+
cy.visit(url);
9090
cy.get('#mc_subheader').should('not.have.css', 'margin-bottom', '18px');
9191
});
9292

@@ -96,8 +96,8 @@ describe('Admin can update plugin settings', () => {
9696
cy.get('input[value="Update Subscribe Form Settings"]').first().click();
9797

9898
// Verify
99-
[shortcodePostId, blockPostId].forEach((postId) => {
100-
cy.visit(`/?p=${postId}`);
99+
[shortcodePostURL, blockPostPostURL].forEach((url) => {
100+
cy.visit(url);
101101
cy.get('#mc_subheader').should('have.css', 'margin-bottom', '18px');
102102
});
103103
});
@@ -113,8 +113,8 @@ describe('Admin can update plugin settings', () => {
113113
cy.get('input[value="Update Subscribe Form Settings"]').first().click();
114114

115115
// Verify
116-
[shortcodePostId, blockPostId].forEach((postId) => {
117-
cy.visit(`/?p=${postId}`);
116+
[shortcodePostURL, blockPostPostURL].forEach((url) => {
117+
cy.visit(url);
118118
cy.get('#mc_signup form').should('have.css', 'border-width', '10px');
119119
cy.get('#mc_signup form').should('have.css', 'border-color', 'rgb(0, 0, 0)');
120120
cy.get('#mc_signup form').should('have.css', 'color', 'rgb(255, 0, 0)');
@@ -135,8 +135,8 @@ describe('Admin can update plugin settings', () => {
135135
cy.get('input[value="Update Subscribe Form Settings"]').first().click();
136136

137137
// Verify
138-
[shortcodePostId, blockPostId].forEach((postId) => {
139-
cy.visit(`/?p=${postId}`);
138+
[shortcodePostURL, blockPostPostURL].forEach((url) => {
139+
cy.visit(url);
140140
cy.get('#mc_mv_FNAME').should('not.exist');
141141
cy.get('#mc_mv_LNAME').should('not.exist');
142142
});
@@ -148,8 +148,8 @@ describe('Admin can update plugin settings', () => {
148148
cy.get('input[value="Update Subscribe Form Settings"]').first().click();
149149

150150
// Verify
151-
[shortcodePostId, blockPostId].forEach((postId) => {
152-
cy.visit(`/?p=${postId}`);
151+
[shortcodePostURL, blockPostPostURL].forEach((url) => {
152+
cy.visit(url);
153153
cy.get('#mc_mv_FNAME').should('exist');
154154
cy.get('#mc_mv_LNAME').should('exist');
155155
});
@@ -164,8 +164,8 @@ describe('Admin can update plugin settings', () => {
164164
cy.get('input[value="Update Subscribe Form Settings"]').first().click();
165165

166166
// Verify
167-
[shortcodePostId, blockPostId].forEach((postId) => {
168-
cy.visit(`/?p=${postId}`);
167+
[shortcodePostURL, blockPostPostURL].forEach((url) => {
168+
cy.visit(url);
169169
cy.get('#mc_submit_type').should('have.value', 'html');
170170
cy.get('#mc_mv_BIRTHDAY').should('not.have.class', 'hasDatepicker');
171171
cy.get('#mc_mv_BIRTHDAY').click();
@@ -180,8 +180,8 @@ describe('Admin can update plugin settings', () => {
180180
cy.get('#mc_use_unsub_link').uncheck();
181181
cy.get('input[value="Update Subscribe Form Settings"]').first().click();
182182

183-
[shortcodePostId, blockPostId].forEach((postId) => {
184-
cy.visit(`/?p=${postId}`);
183+
[shortcodePostURL, blockPostPostURL].forEach((url) => {
184+
cy.visit(url);
185185
cy.get('#mc_submit_type').should('have.value', 'js');
186186
cy.get('#mc_mv_BIRTHDAY').should('have.class', 'hasDatepicker');
187187
cy.get('#mc_mv_BIRTHDAY').click();

0 commit comments

Comments
 (0)