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 <suzanne@forem.com>

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
This commit is contained in:
Daniel Uber 2022-04-21 09:46:17 -05:00 committed by GitHub
parent f6a648c607
commit 2f4f98462e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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');