Cypress - Authentication and Sessions
You want to cache a session but also clear cookies before each test. Which approach correctly combines
cy.session() with cookie clearing?cy.session() with cookie clearing?Cookies must be cleared before session creation to avoid stale data.
Use beforeEach(() => { cy.clearCookies(); cy.session('user', loginFn) }) clears cookies then creates session before each test, ensuring fresh state.
15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions