From 2f4f98462e07ed5afcad2fd4842f1b363fbea6bb Mon Sep 17 00:00:00 2001 From: Daniel Uber Date: Thu, 21 Apr 2022 09:46:17 -0500 Subject: [PATCH] e2e: Reload the page after changing authentication (#17387) * Reload the config page after changing auth When testing in Chrome (but not Firefox or Electron) I noticed this test would fail. The issue appears to have been findByLabelText (used to check Email enabled, Facebook enabled, etc are not visible) was not finding the labels when the group was still hidden. I _think_ there was a time, when this test was first written, that submitting the form reloaded the page (simple form post), but that may have been replaced with an xhr submission and some client side replacement? I tried not clicking the Authentication after enabling invite only (to prevent hiding the form content, leaving this section expanded), however this caused the "Email enabled" check to fail (it was still visible). I think this means it had been passing because it was not visible because the section was hidden, not because the label had been updated properly after the submission. I'm not sure if fixing the test here papers over a UI issue, but it would be best if these tests worked consistently across browsers. I suspect this may have behaved differently in earlier versions of Chrome, or only been tested interactively in Chrome when the page still reloaded, and this caused some drift. * Update cypress/integration/seededFlows/adminFlows/config/authenticationSection.spec.js prefer reload to calling visit a second time Co-authored-by: Suzanne Aitchison Co-authored-by: Suzanne Aitchison --- .../adminFlows/config/authenticationSection.spec.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cypress/integration/seededFlows/adminFlows/config/authenticationSection.spec.js b/cypress/integration/seededFlows/adminFlows/config/authenticationSection.spec.js index 6467b6f49..003750d25 100644 --- a/cypress/integration/seededFlows/adminFlows/config/authenticationSection.spec.js +++ b/cypress/integration/seededFlows/adminFlows/config/authenticationSection.spec.js @@ -41,7 +41,9 @@ describe('Authentication Section', () => { ); }); - cy.url().should('contains', '/admin/customization/config'); + // The page doesn't automatically reload on submission, + // so we reload manually to check the settings have been persisted + cy.reload(); // Page reloaded so need to get a new reference to the form. cy.findByTestId('authSectionForm').as('authSectionForm');