clearAllLocalStorage
Clear localStorage data for all origins with which the test has interacted.
Cypress automatically runs this command before each test to prevent state from being shared across tests. You shouldn't need to use this command unless you're using it to clear localStorage inside a single test.
Syntax
cy.clearAllLocalStorage()
cy.clearAllLocalStorage(options)
Usage
Correct Usage
cy.clearAllLocalStorage()
Arguments
options (Object)
Pass in an options object to change the default behavior of
cy.clearAllLocalStorage()
.
Option | Default | Description |
---|---|---|
log | true | Displays the command in the Command log |
Yields
cy.clearAllLocalStorage()
yieldsnull
.cy.clearAllLocalStorage()
cannot be chained further.
Examples
Clear all localStorage
cy.clearAllLocalStorage()
Rules
Requirements
cy.clearAllLocalStorage()
requires being chained off ofcy
.
Assertions
cy.clearAllLocalStorage()
cannot have any assertions chained.
Timeouts
-
cy.clearAllLocalStorage()
cannot time out.