Skip to content

Commit

Permalink
feat(assertions): add "Then I see hash" and "Then I see hash contains"
Browse files Browse the repository at this point in the history
  • Loading branch information
remarkablemark committed Dec 24, 2022
1 parent a336ace commit 87adae3
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
51 changes: 51 additions & 0 deletions src/assertions/hash.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { Then } from '@badeball/cypress-cucumber-preprocessor';

/**
* Then I see hash:
*
* ```gherkin
* Then I see hash {string}
* ```
*
* @example
*
* ```gherkin
* Then I see hash "#hash"
* ```
*
* @remarks
*
* The URL hash includes the `#` character.
*
* @see
*
* - {@link Then_I_see_hash_contains | Then I see hash contains}
*/
export function Then_I_see_hash(hash: string) {
cy.hash().should('equal', hash);
}

Then('I see hash {string}', Then_I_see_hash);

/**
* Then I see hash contains:
*
* ```gherkin
* Then I see hash contains {string}
* ```
*
* @example
*
* ```gherkin
* Then I see hash contains "hash"
* ```
*
* @see
*
* - {@link Then_I_see_hash | Then I see hash}
*/
export function Then_I_see_hash_contains(hash: string) {
cy.hash().should('contain', hash);
}

Then('I see hash contains {string}', Then_I_see_hash_contains);
1 change: 1 addition & 0 deletions src/assertions/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './hash';
export * from './text';
export * from './url';

0 comments on commit 87adae3

Please sign in to comment.