Skip to content

Commit

Permalink
feat(assertions): pass options to hash steps
Browse files Browse the repository at this point in the history
  • Loading branch information
remarkablemark committed Feb 3, 2024
1 parent 7d4e0b8 commit 2b6fd4d
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions src/assertions/location/hash.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { Then } from '@badeball/cypress-cucumber-preprocessor';
import { DataTable, Then } from '@badeball/cypress-cucumber-preprocessor';

import { getOptions } from '../../utils';

/**
* Then I see hash:
Expand All @@ -13,6 +15,14 @@ import { Then } from '@badeball/cypress-cucumber-preprocessor';
* Then I see hash "#hash"
* ```
*
* With [options](https://docs.cypress.io/api/commands/hash#Arguments):
*
* ```gherkin
* Then I see hash "#hash"
* | log | true |
* | timeout | 4000 |
* ```
*
* @remarks
*
* The URL hash includes the `#` character.
Expand All @@ -21,8 +31,8 @@ import { Then } from '@badeball/cypress-cucumber-preprocessor';
*
* - {@link Then_I_see_hash_contains | Then I see hash contains}
*/
export function Then_I_see_hash(hash: string) {
cy.hash().should('equal', hash);
export function Then_I_see_hash(hash: string, options?: DataTable) {
cy.hash(getOptions(options)).should('equal', hash);
}

Then('I see hash {string}', Then_I_see_hash);
Expand All @@ -40,12 +50,20 @@ Then('I see hash {string}', Then_I_see_hash);
* Then I see hash contains "hash"
* ```
*
* With [options](https://docs.cypress.io/api/commands/hash#Arguments):
*
* ```gherkin
* Then I see hash contains "hash"
* | log | true |
* | timeout | 4000 |
* ```
*
* @see
*
* - {@link Then_I_see_hash | Then I see hash}
*/
export function Then_I_see_hash_contains(hash: string) {
cy.hash().should('contain', hash);
export function Then_I_see_hash_contains(hash: string, options?: DataTable) {
cy.hash(getOptions(options)).should('contain', hash);
}

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

0 comments on commit 2b6fd4d

Please sign in to comment.