-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
No session is defined with the name #22381
Comments
Actually, whether |
Works: it('a', () => {
cy.session('INDY', () => {
'a';
});
cy.session('INDY');
});
it('b', () => {
cy.session('INDY', () => {
'b';
});
cy.session('INDY');
}); Does not work: it('a', () => {
cy.session('INDY', () => {
'a';
});
cy.session('INDY');
});
it('b', () => {
cy.session('INDY', () => {
'a';
});
cy.session('INDY');
}); |
I found that: beforeEach(() => {
// @ts-expect-error Accessing internal property to bypass a bug described in https://github.com/cypress-io/cypress/issues/22381
cy.wrap(Cypress.state('activeSessions', {}));
cy.wrap(Cypress.session.clearAllSavedSessions());
}); gives the desired behavior. |
@gajus Thank you for logging this issues. I can confirm this is a bug. It appears it is related to how we are tracking session ids registered to a particular test. It seems we are only adding unique session ids for a suite instead of adding the session ids associated with the test itself. Glad to hear you have a working around for the time being. |
The code for this is done in cypress-io/cypress#23347, but has yet to be released. |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
Current behavior
Keep running into behavior where a recently declared session is no longer available.
It works on the first test, but fails on the second. Appears to be an issue with how we utilize
clearAllSavedSessions
to reset all sessions.Desired behavior
Declared sessions persist.
Test code to reproduce
Cypress Version
10.1.0
Other
The text was updated successfully, but these errors were encountered: