-
Notifications
You must be signed in to change notification settings - Fork 109
fix: cypress login with new session feature #2039
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
Conversation
Use the new session feature to create and reuse sessions: https://docs.cypress.io/api/commands/session The first time `login` with a given name is called the steps described in the login function are performed and cookies and localstorage are cached. The next time `login` is called with the same name cookies and localStorage are restored and used again. This allows us to keep fast test runs while still separating the tests more cleanly. The old logout command was broken because of the way we used `Cypress.Cookies.defaults({ preserve })` before: Cypress runs all the `cy.*` commands during initialization and builds a list of commands that are then executed during the tests. However `Cypress.Cookies.defaults` is evaluated when preparing the list not while performing the actual steps. Signed-off-by: Azul <[email protected]>
fd51a2a to
448df55
Compare
Open the test.md file once and then check all the things. Signed-off-by: Azul <[email protected]>
448df55 to
02cfe27
Compare
|
I think this is the cleanest way and would be a good basis for implementing more complex tests with cypress. However since it's only available since 8.2.0 we can only backport it to I'm currently working on #2020 and i want to prevent regressions like this in the future. Cypress tests seem to be the best way to ensure we don't break things over and over again to me. However if they are very destinct for old branches and the current one backporting the tests adds yet more maintainance overhead. |
|
Very nice, that is a lot cleaner 👏 I think we could also just bump cypress on the stable branches |
mejo-
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.
Nice, indeed much cleaner than before :)
|
/backport to stable23 |
|
/backport to stable22 |
Use the new session feature to create and reuse sessions:
https://docs.cypress.io/api/commands/session
The first time
loginwith a given name is calledthe steps described in the login function are performed
and cookies and localstorage are cached.
The next time
loginis called with the same namecookies and localStorage are restored and used again.
This allows us to keep fast test runs
while still separating the tests more cleanly.
The old logout command was broken because of the way
we used
Cypress.Cookies.defaults({ preserve })before:Cypress runs all the
cy.*commands during initializationand builds a list of commands that are then executed during the tests.
However
Cypress.Cookies.defaultsis evaluated when preparing the listnot while performing the actual steps.
Signed-off-by: Azul [email protected]