Cypress · Middle · Question 48 of 77
How do you clear cookies or storage inside a test?
- 1Reload the whole page twice in a row quickly
- 2
cy.clearCookies()andcy.clearLocalStorage() - 3
cy.reset({ cookies: true, storage: true })
Show the answer
Correct answer: cy.clearCookies() and cy.clearLocalStorage()
Explanation
Test isolation clears them before each test; these commands help when a test needs a clean state halfway through.