Skip to content

Commit 232f7fa

Browse files
committed
Fix E2E tests.
1 parent f71dd55 commit 232f7fa

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

tests/cypress/e2e/mailchimp-block.test.js

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,11 @@ describe('Block Tests', () => {
3434
const subHeader =
3535
'[BLOCK] Join our mailing list to receive the latest news and updates from our team.';
3636
const button = 'Subscribe Now';
37-
cy.getBlockEditor().find('h2[aria-label="Enter a header."]').clear().type(header);
38-
cy.getBlockEditor().find('h3[aria-label="Enter a sub header."]').clear().type(subHeader);
37+
cy.getBlockEditor().find('h2[aria-label="Enter a header (optional)"]').clear().type(header);
38+
cy.getBlockEditor()
39+
.find('h3[aria-label="Enter a sub header (optional)"]')
40+
.clear()
41+
.type(subHeader);
3942
cy.getBlockEditor().find('button[aria-label="Enter a button text."]').clear().type(button);
4043
cy.get('button.editor-post-publish-button').click();
4144

@@ -116,7 +119,7 @@ describe('Block Tests', () => {
116119
it('Admin can show/hide groups from block settings', () => {
117120
// Show groups
118121
cy.visit(`/wp-admin/post.php?post=${postId}&action=edit`);
119-
cy.getBlockEditor().find('h2[aria-label="Enter a header."]').click();
122+
cy.getBlockEditor().find('h2[aria-label="Enter a header (optional)"]').click();
120123
cy.openDocumentSettingsPanel('Settings', 'Block');
121124
cy.get('.mailchimp-interest-groups input.components-form-toggle__input').first().check();
122125

@@ -130,7 +133,7 @@ describe('Block Tests', () => {
130133

131134
// Hide groups
132135
cy.visit(`/wp-admin/post.php?post=${postId}&action=edit`);
133-
cy.getBlockEditor().find('h2[aria-label="Enter a header."]').click();
136+
cy.getBlockEditor().find('h2[aria-label="Enter a header (optional)"]').click();
134137
cy.openDocumentSettingsPanel('Settings', 'Block');
135138
cy.get('.mailchimp-interest-groups input.components-form-toggle__input').first().uncheck();
136139

@@ -161,7 +164,7 @@ describe('Block Tests', () => {
161164
it('Admin can show/hide unsubscribe link from block settings', () => {
162165
// display unsubscribe link.
163166
cy.visit(`/wp-admin/post.php?post=${postId}&action=edit`);
164-
cy.getBlockEditor().find('h2[aria-label="Enter a header."]').click();
167+
cy.getBlockEditor().find('h2[aria-label="Enter a header (optional)"]').click();
165168
cy.openDocumentSettingsPanel('Form Settings', 'Block');
166169
cy.get('.mailchimp-unsubscribe-link input.components-form-toggle__input').first().check();
167170
cy.get('button.editor-post-publish-button').click();
@@ -173,7 +176,7 @@ describe('Block Tests', () => {
173176

174177
// Reset
175178
cy.visit(`/wp-admin/post.php?post=${postId}&action=edit`);
176-
cy.getBlockEditor().find('h2[aria-label="Enter a header."]').click();
179+
cy.getBlockEditor().find('h2[aria-label="Enter a header (optional)"]').click();
177180
cy.openDocumentSettingsPanel('Form Settings', 'Block');
178181
cy.get('.mailchimp-unsubscribe-link input.components-form-toggle__input').first().uncheck();
179182
cy.get('button.editor-post-publish-button').click();
@@ -187,7 +190,7 @@ describe('Block Tests', () => {
187190
it('Admin can change audience list from block settings', () => {
188191
// display unsubscribe link.
189192
cy.visit(`/wp-admin/post.php?post=${postId}&action=edit`);
190-
cy.getBlockEditor().find('h2[aria-label="Enter a header."]').click();
193+
cy.getBlockEditor().find('h2[aria-label="Enter a header (optional)"]').click();
191194
cy.openDocumentSettingsPanel('Settings', 'Block');
192195
cy.get('.mailchimp-list-select select').select('Alternate 10up Audience');
193196
cy.wait(2000);
@@ -205,7 +208,7 @@ describe('Block Tests', () => {
205208

206209
// Reset
207210
cy.visit(`/wp-admin/post.php?post=${postId}&action=edit`);
208-
cy.getBlockEditor().find('h2[aria-label="Enter a header."]').click();
211+
cy.getBlockEditor().find('h2[aria-label="Enter a header (optional)"]').click();
209212
cy.openDocumentSettingsPanel('Settings', 'Block');
210213
cy.get('.mailchimp-list-select select').select('10up');
211214
cy.wait(2000);
@@ -226,7 +229,10 @@ describe('Block Tests', () => {
226229

227230
cy.visit(`/wp-admin/post.php?post=${oldBlockPostId}&action=edit`);
228231
const header = '[NEW BLOCK] Subscribe to our newsletter';
229-
cy.getBlockEditor().find('h2[aria-label="Enter a header."]').clear().type(header);
232+
cy.getBlockEditor()
233+
.find('h2[aria-label="Enter a header (optional)"]')
234+
.clear()
235+
.type(header);
230236
cy.get('button.editor-post-publish-button').click();
231237
cy.wait(500);
232238

0 commit comments

Comments
 (0)