-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(queries): add "When I find elements by name"
- Loading branch information
1 parent
ce66cd4
commit ae8ffb1
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { When } from '@badeball/cypress-cucumber-preprocessor'; | ||
|
||
import { setCypressElement } from '../utils'; | ||
|
||
/* eslint-disable tsdoc/syntax */ | ||
/** | ||
* When I find elements by name: | ||
* | ||
* ```gherkin | ||
* When I find elements by name {string} | ||
* ``` | ||
* | ||
* > A name is not a good substitute for a label so you should generally use {@link When_I_find_element_by_label_text | "When I find element by label text"} instead. | ||
* | ||
* @example | ||
* | ||
* ```gherkin | ||
* When I find elements by name "text" | ||
* ``` | ||
* | ||
* @remarks | ||
* | ||
* This precedes steps like {@link When_I_type | "When I type"}. For example: | ||
* | ||
* ```gherkin | ||
* When I find elements by name "password" | ||
* And I get 1st element | ||
* And I type "password" | ||
* ``` | ||
*/ | ||
/* eslint-enable tsdoc/syntax */ | ||
export function When_I_find_elements_by_name(name: string) { | ||
setCypressElement(cy.get(`[name='${name}']:visible`)); | ||
} | ||
|
||
When('I find elements by name {string}', When_I_find_elements_by_name); |