diff --git a/src/actions/click.ts b/src/actions/click.ts index c33fa6d1c..839c7761e 100644 --- a/src/actions/click.ts +++ b/src/actions/click.ts @@ -1,10 +1,10 @@ -import { When } from '@badeball/cypress-cucumber-preprocessor'; +import { DataTable, When } from '@badeball/cypress-cucumber-preprocessor'; import { When_I_find_button_by_text, When_I_find_element_by_label_text, } from '../queries'; -import { getCypressElement } from '../utils'; +import { getCypressElement, getOptions } from '../utils'; /** * When I click: @@ -23,6 +23,23 @@ import { getCypressElement } from '../utils'; * When I click * ``` * + * With [options](https://docs.cypress.io/api/commands/click#Arguments): + * + * ```gherkin + * When I click + * | altKey | false | + * | animationDistanceThreshold | 5 | + * | ctrlKey | false | + * | log | true | + * | force | false | + * | metaKey | false | + * | multiple | false | + * | scrollBehavior | top | + * | shiftKey | false | + * | timeout | 4000 | + * | waitForAnimations | true | + * ``` + * * @remarks * * A preceding step like {@link When_I_find_element_by_text | "When I find element by text"} is required. For example: @@ -37,8 +54,8 @@ import { getCypressElement } from '../utils'; * - {@link When_I_double_click | When I double-click} * - {@link When_I_right_click | When I right-click} */ -export function When_I_click() { - getCypressElement().click(); +export function When_I_click(options?: DataTable) { + getCypressElement().click(getOptions(options)); } When('I click', When_I_click);