[Cypress] New session feature might be useful #4116
Replies: 2 comments
-
Actually, after playing with it a little it looks like I won't be able to use it on my new project because we use websocket and there is no session to be restored from cookies, local storage or session storage... So there's a fair chance it won't work well with OpFab's long polling either... |
Beta Was this translation helpful? Give feedback.
-
Hello! Thank you for sharing this new feature you found in the Cypress documentation. The cy.session() command can definitely be helpful for storing and restoring the context of the browser between tests, which can speed up the test suite and also make the tests more reliable by avoiding the need to log in repeatedly. Using cy.session() can also be particularly useful for testing communication between two users, as you mentioned. By switching between sessions, you can simulate multiple users interacting with the application at the same time. I'm glad to hear that you're getting back up to speed on Cypress and I would be interested to hear how this feature works out for you in your new project! |
Beta Was this translation helpful? Give feedback.
-
Hello !
I'm getting back up to speed on Cypress as I'm going to use it on my new project, and going through the documentation I saw this new feature that might be helpful:
https://docs.cypress.io/api/commands/session
The idea seems to be able to store / restore the context of the browser (cookies, localStorage etc.) to reuse a session between test (so there's no need to log in at the start of each test, which might speed tests up a bit).
In particular, it could be useful for tests on communication between two users:
https://docs.cypress.io/api/commands/session#Switching-sessions-inside-tests
I haven't tested it on my new project yet, but I'll let you know how it goes if you're interested!
Beta Was this translation helpful? Give feedback.
All reactions