Skip to content

Commit b6c82cf

Browse files
committed
Remove skip from the unblocked tests and other improvements.
1 parent 6e0a32f commit b6c82cf

File tree

6 files changed

+43
-33
lines changed

6 files changed

+43
-33
lines changed

tests/cypress/e2e/connect.test.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ describe('Admin can connect to "Mailchimp" Account', () => {
2323

2424
// Mailchimp lists exists and has at least one audience
2525
cy.get('#mc_list_id').should('exist');
26-
cy.get('#mc_list_id')
27-
.children()
28-
.should('have.length.greaterThan', 1); // The " — Select A List — " default option will always be present
26+
cy.get('#mc_list_id').children().should('have.length.greaterThan', 1); // The " — Select A List — " default option will always be present
2927
});
3028
});

tests/cypress/e2e/submission/update-subscribers.test.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@ describe('Update Existing Subscriber?', () => {
2828
console.log(`${email} exists`);
2929
}
3030
});
31-
3231
});
3332

3433
function generateRandomString(length = 10) {
35-
return Math.random().toString(36).substring(2, 2 + length);
34+
return Math.random()
35+
.toString(36)
36+
.substring(2, 2 + length);
3637
}
3738

3839
it('Update existing subscribers when they resubmit the signup form if option is checked', () => {
@@ -58,7 +59,7 @@ describe('Update Existing Subscriber?', () => {
5859
expect(contact.merge_fields.LNAME).to.equal(lastName);
5960
});
6061
});
61-
62+
6263
it('Verify that existing subscriber data is updated accurately without creating duplicate records', () => {
6364
// Navigate to the shortcode post
6465
cy.visit(blockPostPostURL);
@@ -78,7 +79,9 @@ describe('Update Existing Subscriber?', () => {
7879
// Verify a duplicate contact has not been created
7980
cy.getListId('10up').then((listId) => {
8081
cy.getContactsFromAList(listId).then((contacts) => {
81-
const filteredByEmail = contacts.filter((contact) => contact.email_address === email);
82+
const filteredByEmail = contacts.filter(
83+
(contact) => contact.email_address === email,
84+
);
8285

8386
expect(filteredByEmail.length).to.equal(1); // Only one match found
8487
expect(filteredByEmail[0].email_address).to.equal(email); // The one match is our email
@@ -89,7 +92,7 @@ describe('Update Existing Subscriber?', () => {
8992
// TODO: This test is correct, but failing to a bug allowing contacts to be updated
9093
// regardless of the "Update Existing Subscriber?" option
9194
// Fix in issue 113 scheduled for 1.7.0.
92-
it.skip('Do not update existing subscribers when they resubmit the signup form if option is unchecked', () => {
95+
it('Do not update existing subscribers when they resubmit the signup form if option is unchecked', () => {
9396
// Not sure why we have to log in here, but we do
9497
cy.login(); // WP
9598

@@ -106,6 +109,8 @@ describe('Update Existing Subscriber?', () => {
106109

107110
// Verify error
108111
cy.submitFormAndVerifyError();
109-
cy.get('.mc_error_msg').contains(/This email address is already subscribed to the list./i);
112+
cy.get('.mc_error_msg').contains(
113+
/This email address has already been subscribed to this list./i,
114+
);
110115
});
111116
});

tests/cypress/e2e/validation/email.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ describe('General merge field validation', () => {
1616
before(() => {
1717
// Load the post URLs from the JSON file
1818
cy.fixture('postUrls').then((urls) => {
19-
blockPostPostURL = urls.blockPostPostURL;
19+
({ blockPostPostURL } = urls);
2020
});
2121

2222
cy.login(); // WP
@@ -93,4 +93,4 @@ describe('General merge field validation', () => {
9393
cy.submitFormAndVerifyError();
9494
cy.get('.mc_error_msg').contains(invalidEmailErrorRegex);
9595
});
96-
});
96+
});

tests/cypress/e2e/validation/us-phone.test.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,34 @@ describe.skip('US Multi-Input Phone Number Validation', () => {
1414

1515
const validPhones = [
1616
{ area: '123', detail1: '456', detail2: '7890' },
17-
{ area: '987', detail1: '654', detail2: '3210' }
17+
{ area: '987', detail1: '654', detail2: '3210' },
1818
];
1919
const invalidPhones = [
2020
{ area: '123', detail1: '456', detail2: '78a0' },
21-
{ area: '123', detail1: '45!', detail2: '7890' }
21+
{ area: '123', detail1: '45!', detail2: '7890' },
2222
];
2323
const tooShortPhones = [
2424
{ area: '12', detail1: '456', detail2: '789' },
25-
{ area: '', detail1: '45', detail2: '7890' }
25+
{ area: '', detail1: '45', detail2: '7890' },
2626
];
2727
const tooLongPhones = [
2828
{ area: '1234', detail1: '567', detail2: '890' },
29-
{ area: '123', detail1: '4567', detail2: '8901' }
29+
{ area: '123', detail1: '4567', detail2: '8901' },
3030
];
3131

3232
before(() => {
3333
cy.login();
3434
cy.mailchimpLoginIfNotAlreadyLoggedIn();
3535

3636
cy.fixture('postUrls').then((urls) => {
37-
shortcodePostURL = urls.shortcodePostURL;
38-
blockPostPostURL = urls.blockPostPostURL;
37+
({ blockPostPostURL } = urls);
3938
});
4039

4140
cy.getListId('10up').then((listId) => {
42-
cy.updateMergeFieldByTag(listId, 'PHONE', { required: true, options: { phone_format: 'US' } }).then(() => {
41+
cy.updateMergeFieldByTag(listId, 'PHONE', {
42+
required: true,
43+
options: { phone_format: 'US' },
44+
}).then(() => {
4345
cy.selectList('10up');
4446
});
4547
});
@@ -50,7 +52,10 @@ describe.skip('US Multi-Input Phone Number Validation', () => {
5052

5153
after(() => {
5254
cy.getListId('10up').then((listId) => {
53-
cy.updateMergeFieldByTag(listId, 'PHONE', { required: false, options: { phone_format: 'none' } });
55+
cy.updateMergeFieldByTag(listId, 'PHONE', {
56+
required: false,
57+
options: { phone_format: 'none' },
58+
});
5459
});
5560
cy.selectList('10up');
5661
cy.setJavaScriptOption(true);

tests/cypress/e2e/validation/validate-required-fields.test.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ describe('Validate required fields', () => {
1919
{ selector: '#mc_mv_MMERGE8', errorMessage: 'Date:', input: '01/01/2030' },
2020
{ selector: '#mc_mv_MMERGE9', errorMessage: 'Zip Code:', input: '12345' },
2121
{ selector: '#mc_mv_MMERGE10', errorMessage: 'Website:', input: 'https://10up.com' },
22-
{ selector: '#mc_mv_MMERGE11', errorMessage: 'Image:', input: 'https://10up.com/wp-content/themes/10up-sept2016/assets/img/icon-strategy.png' },
22+
{
23+
selector: '#mc_mv_MMERGE11',
24+
errorMessage: 'Image:',
25+
input: 'https://10up.com/wp-content/themes/10up-sept2016/assets/img/icon-strategy.png',
26+
},
2327
];
2428

2529
const requiredSelectFields = [
@@ -34,8 +38,8 @@ describe('Validate required fields', () => {
3438

3539
before(() => {
3640
// Load the post URLs from the JSON file
37-
cy.fixture('postUrls').then((urls) => {
38-
blockPostPostURL = urls.blockPostPostURL;
41+
cy.fixture('postUrls').then(({ blockPostPostURL: url }) => {
42+
blockPostPostURL = url;
3943
});
4044

4145
cy.login(); // WordPress login
@@ -108,4 +112,4 @@ describe('Validate required fields', () => {
108112
cy.get(field.selector).type(field.input);
109113
});
110114
});
111-
});
115+
});

tests/cypress/e2e/validation/validate-unrequired-fields.test.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ describe('Validate unrequired fields', () => {
88
before(() => {
99
// Load the post URLs from the JSON file
1010
cy.fixture('postUrls').then((urls) => {
11-
shortcodePostURL = urls.shortcodePostURL;
12-
blockPostPostURL = urls.blockPostPostURL;
11+
({ shortcodePostURL, blockPostPostURL } = urls);
1312
});
1413

1514
cy.login(); // WP
@@ -37,7 +36,7 @@ describe('Validate unrequired fields', () => {
3736
cy.setJavaScriptOption(true);
3837
});
3938

40-
it('Unrequired fields can be submitted while blank', () => {
39+
it('Unrequired fields can be submitted while blank', () => {
4140
[shortcodePostURL, blockPostPostURL].forEach((url) => {
4241
cy.visit(url);
4342

@@ -64,15 +63,14 @@ describe('Validate unrequired fields', () => {
6463
const email = generateRandomEmail('unrequired-validation-test');
6564
cy.get('#mc_mv_EMAIL').type(email);
6665

67-
// // TODO: This is failing because of a bug causing single opt-in to malfunction. Fix is ready for 1.7.0.
6866
// Step 6: Verify that the form was submitted successfully
69-
// cy.submitFormAndVerifyWPSuccess();
67+
cy.submitFormAndVerifyWPSuccess();
7068

71-
// // Step 7: Verify that the contact was added to the Mailchimp account via the Mailchimp API
72-
// cy.verifyContactInMailchimp(email);
69+
// Step 7: Verify that the contact was added to the Mailchimp account via the Mailchimp API
70+
cy.verifyContactInMailchimp(email);
7371

74-
// // Step 8: Cleanup and delete contact
75-
// cy.deleteContactFromList(email);
72+
// Step 8: Cleanup and delete contact
73+
cy.deleteContactFromList(email);
7674

7775
/**
7876
* Phone Number - Handled in /validation/us-phone.test.js
@@ -91,4 +89,4 @@ describe('Validate unrequired fields', () => {
9189
// Test last name - no validation
9290
});
9391
});
94-
});
92+
});

0 commit comments

Comments
 (0)