Skip to content

Commit

Permalink
feat(actions): add "When I clear all cookies"
Browse files Browse the repository at this point in the history
  • Loading branch information
remarkablemark committed Dec 2, 2023
1 parent 151c6f9 commit 1b8da91
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/actions/cookies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,47 @@ import { getOptions } from '../utils';
* @see
*
* - {@link When_I_clear_cookie | When I clear cookie}
* - {@link When_I_clear_all_cookies | When I clear all cookies}
*/
export function When_I_clear_cookies(options?: DataTable) {
cy.clearCookies(getOptions(options));
}

When('I clear cookies', When_I_clear_cookies);

/**
* When I clear all cookies:
*
* ```gherkin
* When I clear all cookies
* ```
*
* Clear all browser cookies.
*
* @example
*
* ```gherkin
* When I clear all cookies
* ```
*
* With [options](https://docs.cypress.io/api/commands/clearallcookies#Arguments):
*
* ```gherkin
* When I clear all cookies
* | log | true |
* | timeout | 3000 |
* ```
*
* @remarks
*
* Cypress automatically clears all cookies _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 a specific cookie inside a single test or test isolation is disabled.
*
* @see
*
* - {@link When_I_clear_cookies | When I clear cookies}
*/
export function When_I_clear_all_cookies(options?: DataTable) {
cy.clearAllCookies(getOptions(options));
}

When('I clear all cookies', When_I_clear_all_cookies);

0 comments on commit 1b8da91

Please sign in to comment.