diff --git a/src/assertions/hash.ts b/src/assertions/hash.ts new file mode 100644 index 000000000..fab1ae1d0 --- /dev/null +++ b/src/assertions/hash.ts @@ -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); diff --git a/src/assertions/index.ts b/src/assertions/index.ts index 4907a4286..46d450e42 100644 --- a/src/assertions/index.ts +++ b/src/assertions/index.ts @@ -1,2 +1,3 @@ +export * from './hash'; export * from './text'; export * from './url';