Skip to content

Keep the page state after user logs in when using cy.session() #22368

@vergjor

Description

@vergjor

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 the validate() 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:

    validate() {
      cy.visit('/');
      cy.location('pathname', { timeout: 30000 }).should('equals', '/home');
    },

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

Metadata

Metadata

Labels

topic: sessionIssues when using session commandtype: enhancementRequested enhancement of existing feature

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions