Skip to content

Commit

Permalink
feat(assertions): add "Then I do not see local storage item"
Browse files Browse the repository at this point in the history
  • Loading branch information
remarkablemark committed Dec 3, 2023
1 parent 8c09e2b commit 1c8af68
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion src/assertions/local-storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Then } from '@badeball/cypress-cucumber-preprocessor';
* Then I see local storage item {string}
* ```
*
* Assert local storage item with key **_exists_**.
* Assert local storage item **_exists_**.
*
* @example
*
Expand All @@ -22,3 +22,29 @@ export function Then_I_see_local_storage_item(key: string) {
}

Then('I see local storage item {string}', Then_I_see_local_storage_item);

/**
* Then I do not see local storage item:
*
* ```gherkin
* Then I do not see local storage item {string}
* ```
*
* Assert local storage item **_does not exist_**.
*
* @example
*
* ```gherkin
* Then I do not see local storage item "key"
* ```
*/
export function Then_I_do_not_see_local_storage_item(key: string) {
cy.wrap({}).should(() => {
expect(localStorage.getItem(key)).to.not.exist;
});
}

Then(
'I do not see local storage item {string}',
Then_I_do_not_see_local_storage_item,
);

0 comments on commit 1c8af68

Please sign in to comment.