-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Keep the page state after user logs in when using cy.session() #22368
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
Comments
+1 for this. We only have one E2E flow in our product (but with certain variations) and our E2E test just wouldn't make sense if the previous page state isn't carried over. I'm having to resort putting all the test steps inside an entire However, I understand that tests, in theory, should have isolated state. So I'd like to propose maybe we have a
However, I know OP's idea was more for performance sake of reusing the state from previous test and this is more for readability, but I feel this might still work for both use cases. |
@devhid This request is to remove the last "Clear Page" step that executed in the What you are describing is disabling test isolation for a set of tests to have better readability and more granular tests for a given point in your application. This actually requested in #22279 and the full extend of this work can be tracked on #22230. |
I personally like having isolation between |
The code for this is done in cypress-io/cypress#23503, but has yet to be released. |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
What would you like?
I think we could benefit from a small modification of the
cy.session()
command where after the user logs into the application or if thevalidate()
method is run we could continue from that state in the tests, instead of the page being cleared.Why is this needed?
When we use
cy.session()
and we add a validation for the session like in my case by trying to open a specific page that is only accessible if the user is logged in, then I would have to use:and this is the only way I can validate the login for our application. Then after the session we need to again use cy.visit() to navigate to the home page which is again extra time to re-load everything instead of just continuing from the validation or login state.. removing the blank page part would be amazing
Other
No response
The text was updated successfully, but these errors were encountered: