Skip to content

Commit

Permalink
feat(actions): add "When I type"
Browse files Browse the repository at this point in the history
  • Loading branch information
remarkablemark committed Dec 10, 2022
1 parent dfe6c77 commit fa95e54
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/actions/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export * from './click';
export * from './reload';
export * from './type';
export * from './visit';
export * from './wait';
31 changes: 31 additions & 0 deletions src/actions/type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { When } from '@badeball/cypress-cucumber-preprocessor';

import { getCypressElement } from '../utils';

/**
* When I type:
*
* ```gherkin
* When I type {string}
* ```
*
* @example
*
* ```gherkin
* When I type "Hello, world!"
* ```
*
* @remarks
*
* This requires a preceding step like query {@link When_I_get_element_by_label_text | "When I get element by label text"}. E.g.:
*
* ```gherkin
* When I get element by label text "Email"
* And I type "user@example.com"
* ```
*/
export function When_I_type(text: string) {
getCypressElement(this).type(text);
}

When('I type {string}', When_I_type);

0 comments on commit fa95e54

Please sign in to comment.