-
Notifications
You must be signed in to change notification settings - Fork 0
Allow Cypress tests to log in programmatically as two different users #6
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
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Co-authored-by: gennitdev <114821397+gennitdev@users.noreply.github.com>
Co-authored-by: gennitdev <114821397+gennitdev@users.noreply.github.com>
gennitdev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a big improvement over the status quo. Previously, when running voteOnComments.spec.cy.ts, the second user was still logged in as user 1. Now at least the auth state is successfully cleared, so the second user is logged out instead of logged in as user 1. But when they click the upvote button, unfortunately because they are not already logged in by that point, the operation cannot go through successfully (they are prompted to log in instead, because only logged in users can upvote comments). Can you fix it?
Co-authored-by: gennitdev <114821397+gennitdev@users.noreply.github.com>
Fixed the authentication chaining issue in The fix properly chains these operations using Commit: 422f1d0 Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
This PR implements enhanced programmatic authentication for Cypress tests that supports reliable switching between multiple users within the same test.
Problem
The existing Cypress authentication system couldn't reliably switch between different users in the same test. The
voteOnComments.spec.cy.tstest was failing because:Solution
Enhanced Authentication Commands
Improved
clearAllAuthState():@@auth0spajs@@patterns)Enhanced
loginAsUser():New
switchToUser()command:Example Usage
Additional Improvements
useTestAuthto default layout for better test function availabilityTesting
userSwitching.spec.cy.tsto validate multi-user authentication flowvoteOnComments.spec.cy.tsto use the enhanced authenticationtests/cypress/AUTHENTICATION.mdThis enables reliable programmatic authentication switching that was previously blocking the migration from UI-based to programmatic authentication in Cypress tests.
Fixes #5.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.