Cypress · Middle · Question 48 of 77

How do you clear cookies or storage inside a test?

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.

Further reading

Problem with a question

Cypress · Middle · question 48

Test yourself

Take the Cypress · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz