From e4d4f4d6f4bbf1ee780436d040526cc08e13e891 Mon Sep 17 00:00:00 2001 From: Mark Date: Thu, 15 Dec 2022 18:33:41 -0500 Subject: [PATCH] feat(actions): add "When I clear" --- src/actions/type.ts | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) 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: *