diff --git a/src/assertions/exist.ts b/src/assertions/exist.ts new file mode 100644 index 000000000..a06374e7a --- /dev/null +++ b/src/assertions/exist.ts @@ -0,0 +1,33 @@ +import { Then } from '@badeball/cypress-cucumber-preprocessor'; + +import { getCypressElement } from '../utils'; + +/** + * Then I see element exists: + * + * ```gherkin + * Then I see element exists + * ``` + * + * Assert element **_exists_** in the screen. + * + * @example + * + * ```gherkin + * Then I see element exists + * ``` + * + * @remarks + * + * A preceding step like {@link When_I_find_element_by_text | "When I find element by text"} is required. For example: + * + * ```gherkin + * When I find element by text "Text" + * Then I see element exists + * ``` + */ +export function Then_I_see_element_exists() { + getCypressElement().should('exist'); +} + +Then('I see element exists', Then_I_see_element_exists); diff --git a/src/assertions/index.ts b/src/assertions/index.ts index d5bc07a4a..99ff44de0 100644 --- a/src/assertions/index.ts +++ b/src/assertions/index.ts @@ -3,6 +3,7 @@ export * from './button'; export * from './cookie'; export * from './count'; export * from './document-title'; +export * from './exist'; export * from './hash'; export * from './heading'; export * from './label';