Cypress has recently deprecated preserveOnce for cookies. I struggle to follow the documentation and update my tests with cy.session().
Previously my tests for both guest & logged in users would read like this:
beforeEach(() => { Cypress.Cookies.preserveOnce("JSESSIONID"); cy.setCookie("OptanonAlertBoxClosed", "true"); });
This would cache the JSESSIONID cookie & mean that user data etc is not lost between test steps. e.g going from cart -> checkout would not lose the basket contents or login state etc.
I'm struggling with how I can achieve this with the experimental 'session' feature. I don't want to include this in a login function as it mentions.
Any help would be greatly appreciated on how I can achieve this!