I have this test where it logs via cy.request() in and creates the session object in before each:
cy.request({
method: 'POST',
url: `${URL}/sessions`,
body: {
userName: 'xxx',
password: 'yyy',
},
});
Then during the first test it logs out via the interface:
cy.page()
.get('button[logout="UserMainMenu"]')
.should('be.lengthOf', 1).click({ force: true })...
That works until now. But then the next test starts, doing the beforeEach() again.
Then it tries to restore the session object. But can't and after a time out recreates it.

I would like to avoid this timeout, and started to add the following commands:
cy.clearAllCookies();
cy.clearAllLocalStorage();
cy.clearAllSessionStorage();
How ever this does not make a difference. It still recreates:

Current version of cypress: 12.4.1
OK. I found it: to clear the complete session, it needs this command:
Cypress.session.clearAllSavedSessions()
(a logout via interface and login again (with same user) seems to inactivate the session)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With