-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(actions): add "When I clear local storage"
- Loading branch information
1 parent
0635759
commit df2407b
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { When } from '@badeball/cypress-cucumber-preprocessor'; | ||
|
||
/* eslint-disable tsdoc/syntax */ | ||
/** | ||
* When I clear local storage: | ||
* | ||
* ```gherkin | ||
* When I clear local storage | ||
* When I clear local storage {string} | ||
* ``` | ||
* | ||
* @example | ||
* | ||
* Clear all localStorage: | ||
* | ||
* ```gherkin | ||
* When I clear local storage | ||
* ``` | ||
* | ||
* Clear localStorage with the key `appName`: | ||
* | ||
* ```gherkin | ||
* When I clear local storage "appName" | ||
* ``` | ||
* | ||
* @remarks | ||
* | ||
* Clears [`localStorage`](https://developer.mozilla.org/docs/Web/API/Window/localStorage) data for current domain and subdomain. | ||
* | ||
* > Cypress automatically clears all local storage before each test to prevent state from being shared across tests when [test isolation](https://docs.cypress.io/guides/core-concepts/writing-and-organizing-tests#Test-Isolation) is enabled. | ||
* > | ||
* > You shouldn't need to use this command unless you're using it to clear localStorage inside a single test or test isolation is disabled. | ||
*/ | ||
/* eslint-enable tsdoc/syntax */ | ||
export function When_I_clear_local_storage(key?: string) { | ||
cy.clearLocalStorage(key); | ||
} | ||
|
||
When('I clear local storage', When_I_clear_local_storage); | ||
When('I clear local storage {string}', When_I_clear_local_storage); |