Skip to content
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

[feat] cy.clearSession command #17991

Open
alvaromartmart opened this issue Sep 6, 2021 · 0 comments
Open

[feat] cy.clearSession command #17991

alvaromartmart opened this issue Sep 6, 2021 · 0 comments
Labels
stage: proposal 💡 No work has been done of this issue topic: session Issues when using session command type: feature New feature that does not currently exist

Comments

@alvaromartmart
Copy link

What would you like?

I'd like cypress to add a command that allows explicitly clearing a specific cached session.
Something like

cy.clearSession([user, password]);

Alternatively, the cy.session command could accept an optional argument that forces the session to be re-created (as it would be if the validation function fails, but this is not working due to #17805 and besides it's not exactly the same use case)

cy.session([user, password], () => {
    /* [...] */ 
}, {
    // This would skip the initial validate function and run the setup again
    reset: true
});

Why is this needed?

The Cypress.session.clearAllSavedSessions() command is not enough as I want to clear specific sessions.

Example scenario:
In an application I'm working on, there is some server code that invalidates all user's sessions when a password reset is completed. Therefore when testing that workflow I can anticipate the session to be invalid in under certain circumstances, and would like to be able to recreate the session without waiting for the validate function to fail.

Other

No response

@jennifer-shehane jennifer-shehane added topic: session Issues when using session command stage: proposal 💡 No work has been done of this issue labels Sep 7, 2021
@emilyrohrbough emilyrohrbough added the type: feature New feature that does not currently exist label Nov 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stage: proposal 💡 No work has been done of this issue topic: session Issues when using session command type: feature New feature that does not currently exist
Projects
None yet
Development

No branches or pull requests

3 participants