Skip to content

test(e2e): allow testing of multiple users - #54752

Merged
huyenltnguyen merged 2 commits into
freeCodeCamp:mainfrom
ojeytonwilliams:test/multiple-users
May 13, 2024
Merged

huyenltnguyen merged 2 commits into
freeCodeCamp:mainfrom
ojeytonwilliams:test/multiple-users

Conversation

@ojeytonwilliams

@ojeytonwilliams ojeytonwilliams commented May 13, 2024 •

Copy link
Copy Markdown
Contributor
  • test(e2e): setup two user's storageStates
  • test(e2e): test signing in via the ui

Checklist:

This allows tests to switch users by seeding the user they want and test.useing the storageState of that user.

There is an alternative approach that I didn't go with, but we could consider. Using the same _id for whichever user is signed in. i.e. when seeding the db, the [email protected] user would always have the same _id, regardless of the rest of the document. I don't like this because it's not so clear what's going on, but it would mean we could use the same storageState for all users and only need to change the db to change who is signed in.

However, neither approach will work for #54751 so I went with the (hopefully) less confusing one for now.

With these changes it's now possible to switch between users by both
seeding the desired user and switching to their storage state
Now that global-setup uses api requests (to save time), this adds a spec
to test the ui.
@ojeytonwilliams
ojeytonwilliams requested a review from a team May 13, 2024 10:54
@github-actions github-actions Bot added the scope: tools/scripts Scripts for supporting dev work, generating config and build artifacts, etc. label May 13, 2024
Comment thread e2e/global-setup.ts Resolved
@huyenltnguyen
huyenltnguyen merged commit 86860e8 into freeCodeCamp:main May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: tools/scripts Scripts for supporting dev work, generating config and build artifacts, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants