Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experiment/create ephemeral UI test accts #1898

Open
wants to merge 46 commits into
base: main
Choose a base branch
from

Conversation

andrewleith
Copy link
Member

@andrewleith andrewleith commented Jul 22, 2024

Summary | Résumé

This PR hooks into the new /cypress endpoints introduced in #2286 in order to create UI testing alias accounts on the fly.

The end result is that test runs will no longer interfere with each other, meaning we can run as many suites concurrently as we want on the same environment.

Notes

  • A lot of this PR is modifying the existing tests to use the simplified login command.
  • The config.js file was simplified and the template and service IDs are now hardcoded and exist in all environments
  • A new cypress plugin was created to handle calling the /cypress endpoint on the backend to get new accounts created
  • The email plugin has been updated to only get 2FA codes from the particular alias you are logging in as and ignores all other codes.
  • The login command was simplified and now comes in two flavors: login (regular user) and loginAsPlatformAdmin (platform admin user)

Copy link

Copy link

Copy link

github-actions bot commented Nov 8, 2024

@andrewleith andrewleith marked this pull request as ready for review November 15, 2024 18:22
},
deleteAllEmails() {
return emailAccount.deleteAllEmails()
},
fetchEmail(acct) {
return emailAccount.fetchEmail(acct)
},
createEmailAccount() {
return emailAccount.createEmailAccount();
createAccount({ baseUrl, username, secret }) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The result of this call is "cached" in the global object here, which means only one set of test users is generated for every test run or every time you launch the cypress UI. To get a new user, just quit cypress and launch it again.

@@ -82,7 +82,7 @@ const pages = [
describe(`A11Y - App pages [${config.CONFIG_NAME}]`, () => {
for (const page of pages) {
it(`${page.name}`, () => {
cy.login(Cypress.env("NOTIFY_USER"), Cypress.env("NOTIFY_PASSWORD"));
cy.login();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The login command has been simplified to use the generated user and the password automatically.

const mail = await simpleParser(message.parts[0].body);
const to_address = mail.to.value[0].address;

if (to_address == emailAddress) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only get 2FA codes for the specific email alias we are testing with 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant