Skip to content

Commit

Permalink
feat(assertions): add "Then I see link"
Browse files Browse the repository at this point in the history
  • Loading branch information
remarkablemark committed Dec 31, 2022
1 parent afb5974 commit 278a44c
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/assertions/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export * from './element';
export * from './hash';
export * from './link';
export * from './text';
export * from './url';
28 changes: 28 additions & 0 deletions src/assertions/link.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Then } from '@badeball/cypress-cucumber-preprocessor';

/**
* Then I see link:
*
* ```gherkin
* Then I see link {string}
* ```
*
* @example
*
* ```gherkin
* Then I see link "Hello, world!"
* ```
*
* @remarks
*
* This asserts that a link with text **_exists_** and is **_visible_** in the screen.
*
* @see
*
* - {@link Then_I_see_text | Then I see text}
*/
export function Then_I_see_link(text: string) {
cy.contains('a', text).should('exist').and('be.visible');
}

Then('I see link {string}', Then_I_see_link);
11 changes: 4 additions & 7 deletions src/assertions/text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@ import { Then } from '@badeball/cypress-cucumber-preprocessor';
*
* @remarks
*
* This asserts that the text _exists_ and is _visible_ in the screen.
* This asserts that an element with text **_exists_** and is **_visible_** in the screen.
*
* @see
*
* - {@link Then_I_do_not_see_text | Then I do not see text}
* - {@link Then_I_do_not_see_visible_text | Then I do not see visible text}
* - {@link Then_I_see_link | Then I see link}
*/
export function Then_I_see_text(text: string) {
cy.contains(text).should('exist').and('be.visible');
Expand All @@ -43,11 +42,10 @@ Then('I see text {string}', Then_I_see_text);
*
* @remarks
*
* This asserts that the text _does not exist_ in the screen.
* This asserts that the text **_does not exist_** in the screen.
*
* @see
*
* - {@link Then_I_see_text | Then I see text}
* - {@link Then_I_do_not_see_visible_text | Then I do not see visible text}
*/
export function Then_I_do_not_see_text(text: string) {
Expand All @@ -71,11 +69,10 @@ Then('I do not see text {string}', Then_I_do_not_see_text);
*
* @remarks
*
* This asserts that the text _exists_ in the screen but is _hidden_.
* This asserts that the text **_exists_** in the screen but is **_hidden_**.
*
* @see
*
* - {@link Then_I_see_text | Then I see text}
* - {@link Then_I_do_not_see_text | Then I do not see text}
*/
export function Then_I_do_not_see_visible_text(text: string) {
Expand Down

0 comments on commit 278a44c

Please sign in to comment.