Skip to content

Commit 20beac2

Browse files
committed
E2E: Add tests for block as well.
1 parent c157350 commit 20beac2

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,22 @@ describe('Block Tests', () => {
246246
});
247247
});
248248

249+
it('Form data should persist if validation fails', () => {
250+
// Verify
251+
const firstName = 'John';
252+
const lastName = 'Doe';
253+
cy.visit(`/?p=${postId}`);
254+
cy.get('#mc_mv_EMAIL').should('exist');
255+
cy.get('#mc_mv_FNAME').clear().type(firstName);
256+
cy.get('#mc_mv_LNAME').clear().type(lastName);
257+
cy.get('#mc_signup_submit').should('exist');
258+
cy.get('#mc_signup_submit').click();
259+
cy.get('.mc_error_msg').should('exist');
260+
cy.get('.mc_error_msg').contains('Email Address: This value should not be blank.');
261+
cy.get('#mc_mv_FNAME').should('have.value', firstName);
262+
cy.get('#mc_mv_LNAME').should('have.value', lastName);
263+
});
264+
249265
// TODO: Add tests for the Double Opt-in and Update existing subscribers settings.
250266
// TODO: Add tests for the block styles settings.
251267
// TODO: Add tests for the form submission.

0 commit comments

Comments
 (0)