Skip to content

Commit 7cb8ffd

Browse files
If a user has not saved a list they can not see the form
1 parent b6d1da1 commit 7cb8ffd

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed

tests/cypress/e2e/settings.test.js

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,32 @@ describe('Admin can update plugin settings', () => {
2929
cy.get('#mc-message .success_msg b').contains('Success!');
3030
});
3131

32+
// TODO: BLOCKED - Need separate Mailchimp user to finish this test
33+
it.skip('Admin that has never saved a list can not see the form on the front end', () => {
34+
// Step 1: Log the user out of the current account (if logged in)
35+
cy.visit('/wp-admin/admin.php?page=mailchimp_sf_options');
36+
cy.mailchimpLogout();
37+
38+
// Verify the user is logged out
39+
cy.get('#mailchimp_sf_oauth_connect').should('exist');
40+
41+
// Step 2: Log in with a test user account that has never saved a list
42+
// TODO: BLOCKED - We need a second user here to finish this test
43+
cy.mailchimpLogin('test_user_no_list@mailchimp.com', 'password123'); // TODO: CHANGE LOG IN HERE
44+
cy.visit('/wp-admin/admin.php?page=mailchimp_sf_options');
45+
46+
// Verify no list is saved for the test user
47+
cy.get('#mc_list_id').should('have.value', ''); // Assuming empty value indicates no list is saved
48+
49+
// Step 3: Verify the signup form is not displayed on the frontend
50+
cy.visit('/'); // Navigate to the frontend homepage
51+
cy.get('#mc_signup').should('not.exist'); // Ensure the form does not exist
52+
});
53+
3254
// TODO: Default settings are populated as expected
55+
it.skip('The default settings populate as expected', () => {
56+
// Test here...
57+
});
3358

3459
it('Admin can create a Signup form using the shortcode', () => {
3560
const postTitle = 'Mailchimp signup form - shortcode';
@@ -324,13 +349,4 @@ describe('Admin can update plugin settings', () => {
324349
// Step 7: Ensure the original settings persist
325350
cy.get('#mc_header_content').should('have.value', customHeader);
326351
});
327-
328-
// TODO: BLOCKED - Need separate Mailchimp user to finish this test
329-
it.skip('The signup form is not displayed on the front end unless a list is saved', () => {
330-
// TODO: Log the user out and verify no sign up form exists on the frontend
331-
// TODO: BLOCKED - Option 1 (preferred): Use a test user that has never saved a list to verify the list can
332-
// not be seen on the FE
333-
// Option 2: Delete the option that saves the list selection in the DB to test that a sign up form
334-
// will not display on the FE without being selected. Would require interacting with the BE.
335-
});
336352
});

0 commit comments

Comments
 (0)