Skip to main content
Cypress App

clearAllCookies

Clear all browser cookies.

caution

Cypress automatically clears all cookies before each test to prevent state from being shared across tests when test isolation is enabled. You shouldn't need to use this command unless you're using it to clear all cookies inside a single test or test isolation is disabled.

Syntax​

cy.clearAllCookies()
cy.clearAllCookies(options)

Usage​

Correct Usage

cy.clearAllCookies() // Clear all cookies

Arguments​

options (Object)

Pass in an options object to change the default behavior of cy.clearAllCookies().

OptionDefaultDescription
logtrueDisplays the command in the Command log
timeoutresponseTimeoutTime to wait for cy.clearAllCookies() to resolve before timing out

Yields Learn about subject management​

  • cy.clearAllCookies() yields null.

Rules​

Requirements Learn about chaining commands​

  • cy.clearAllCookies() requires being chained off of cy.

Assertions Learn about assertions​

  • cy.clearAllCookies() cannot have any assertions chained.

Timeouts Learn about timeouts​

  • cy.clearAllCookies() should never time out.
caution

Because cy.clearAllCookies() is asynchronous it is technically possible for there to be a timeout while talking to the internal Cypress automation APIs. But for practical purposes it should never happen.

See also​