Skip to content

Commit

Permalink
Add data persistence test
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxwellGarceau committed Jan 10, 2025
1 parent 8f44eac commit ded9cf9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/cypress/e2e/settings/admin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('Admin can login and make sure plugin is activated', () => {
cy.get('#mailchimp-sf-create-activate-account').should('be.visible');
});

it("Admin shouldn't able to submit create account form with invalid data", () => {
it("Admin shouldn't be able to submit create account form with invalid data", () => {
cy.visit('/wp-admin/admin.php?page=mailchimp_sf_create_account');

// If logged in then log out
Expand Down
16 changes: 16 additions & 0 deletions tests/cypress/e2e/settings/data-persistence.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* eslint-disable no-undef */
describe('Settings data persistence', () => {
before(() => {
cy.login();
});

it('Settings and list selection remain persistent between logging out and logging back in with the same account', () => {
// Logout
cy.mailchimpLogout();
cy.logout();

// Login
cy.login();
cy.mailchimpLogin();
});
});
2 changes: 2 additions & 0 deletions tests/cypress/support/commands/mailchimpLogin.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
* Log out of Mailchimp account
*/
Cypress.Commands.add('mailchimpLogout', () => {
cy.visit('/wp-admin/admin.php?page=mailchimp_sf_options');

// Logout if already connected.
cy.get('body').then(($body) => {
if ($body.find('input[value="Logout"]').length > 0) {
Expand Down

0 comments on commit ded9cf9

Please sign in to comment.