diff --git a/src/actions/type.ts b/src/actions/type.ts index c92f31d09..5c6f676b9 100644 --- a/src/actions/type.ts +++ b/src/actions/type.ts @@ -2,6 +2,40 @@ import { When } from '@badeball/cypress-cucumber-preprocessor'; import { getCypressElement } from '../utils'; +/** + * When I clear: + * + * ```gherkin + * When I clear + * ``` + * + * Alias for {@link When_I_type | "When I type"}: + * + * ```gherkin + * When I type "{selectall}{backspace}" + * ``` + * + * @example + * + * ```gherkin + * When I clear + * ``` + * + * @remarks + * + * This requires a preceding step like {@link When_I_get_element_by_label_text | "When I get element by label text"}. For example: + * + * ```gherkin + * When I get element by label text "Input" + * And I clear + * ``` + */ +export function When_I_clear() { + getCypressElement(this).clear(); +} + +When('I clear', When_I_clear); + /** * When I type: *