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()
.
Option | Default | Description |
---|---|---|
log | true | Displays the command in the Command log |
timeout | responseTimeout | Time to wait for cy.clearAllCookies() to resolve before timing out |
Yields ​
cy.clearAllCookies()
yieldsnull
.
Rules​
Requirements ​
cy.clearAllCookies()
requires being chained off ofcy
.
Assertions ​
cy.clearAllCookies()
cannot have any assertions chained.
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.