Skip to content

Commit 8910450

Browse files
committed
PR feedback.
1 parent 598df52 commit 8910450

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

tests/cypress/e2e/settings/settings.test.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,12 @@ describe('Admin can update plugin settings', () => {
8989
.scrollIntoView({ offset: { top: -100, left: 0 } })
9090
.should('be.visible') // Check if the button is visible
9191
.and('not.be.disabled'); // Ensure the button is not disabled
92-
// .click(); // Perform the click action
9392

9493
// Ensure that custom CSS does not cover submit button
9594
cy.get('#mc_signup_submit')
9695
.then(($el) => {
9796
const rect = $el[0].getBoundingClientRect();
98-
97+
9998
// Check that the element is within the viewport
10099
cy.window().then((win) => {
101100
const windowHeight = win.innerHeight;
@@ -112,7 +111,7 @@ describe('Admin can update plugin settings', () => {
112111
// Check if the center of the element is not covered by another element
113112
const centerX = rect.x + $el[0].offsetWidth / 2;
114113
const centerY = rect.y + $el[0].offsetHeight / 2;
115-
114+
116115
cy.document().then((doc) => {
117116
const topElement = doc.elementFromPoint(centerX, centerY);
118117
expect(topElement).to.equal($el[0]);
@@ -228,43 +227,43 @@ describe('Admin can update plugin settings', () => {
228227
// Step 1: Visit Mailchimp settings page
229228
cy.visit('/wp-admin/admin.php?page=mailchimp_sf_options');
230229
cy.get('#mailchimp_sf_oauth_connect').should('not.exist');
231-
230+
232231
// Step 2: Set an option different from the default
233232
const customHeader = 'My Custom Header';
234233
cy.get('#mc_header_content').clear().type(customHeader);
235234
cy.get('input[value="Update Subscribe Form Settings"]').first().click();
236-
235+
237236
// Verify the custom header is saved
238237
cy.get('#mc-message .success_msg b').contains('Success!');
239238
cy.get('#mc_header_content').should('have.value', customHeader);
240-
239+
241240
// Step 3: Log out of the Mailchimp account
242241
cy.get('input[value="Logout"]').click();
243242
// Verify the logout was successful
244243
cy.get('#mailchimp_sf_oauth_connect').should('exist');
245-
244+
246245
// Step 4: Log in with a different Mailchimp account
247246
// TODO: BLOCKED - We need a separate Mailchimp account to test the login here
248247
cy.mailchimpLogin('different@mailchimp.com', 'password123'); // TODO: CHANGE LOG IN HERE
249248
cy.visit('/wp-admin/admin.php?page=mailchimp_sf_options');
250-
249+
251250
// Verify the default options are displayed for the new account
252251
cy.get('#mc_header_content').should('not.have.value', customHeader); // Expect default value
253-
252+
254253
// Step 5: Set another option with the second account to test persistence
255254
const differentHeader = 'Another Custom Header';
256255
cy.get('#mc_header_content').clear().type(differentHeader);
257256
cy.get('input[value="Update Subscribe Form Settings"]').first().click();
258-
257+
259258
// Verify the new setting is saved for the second account
260259
cy.get('#mc-message .success_msg b').contains('Success!');
261260
cy.get('#mc_header_content').should('have.value', differentHeader);
262-
261+
263262
// Step 6: Log back in with the original Mailchimp account
264263
cy.get('input[value="Logout"]').click();
265264
cy.mailchimpLogin(); // Default to user set in env
266265
cy.visit('/wp-admin/admin.php?page=mailchimp_sf_options');
267-
266+
268267
// Step 7: Ensure the original settings persist
269268
cy.get('#mc_header_content').should('have.value', customHeader);
270269
});

0 commit comments

Comments
 (0)