UNPKG

cypress-cucumber-steps

Version:
97 lines 2.73 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.When_I_find_elements_by_role = When_I_find_elements_by_role; exports.When_I_find_element_by_role = When_I_find_element_by_role; var cypress_cucumber_preprocessor_1 = require("@badeball/cypress-cucumber-preprocessor"); var constants_1 = require("../constants"); var utils_1 = require("../utils"); /** * When I find elements by role: * * ```gherkin * When I find elements by role {string} * ``` * * Queries for elements with the given role. * * @example * * ```gherkin * When I find elements by role "progressbar" * ``` * * With [options](https://docs.cypress.io/api/commands/get#Arguments): * * ```gherkin * When I find elements by role "progressbar" * | log | true | * | timeout | 4000 | * | withinSubject | null | * | includeShadowDom | false | * ``` * * @remarks * * This precedes steps like {@link When_I_click | "When I click"}. For example: * * ```gherkin * When I find elements by role "progressbar" * And I get 1st element * And I click * ``` * * Inspired by Testing Library's [ByRole](https://testing-library.com/docs/queries/byrole/). * * @see * * - {@link When_I_find_element_by_role | When I find element by role} */ function When_I_find_elements_by_role(role, options) { (0, utils_1.setCypressElement)((0, utils_1.getRoleElements)(role, constants_1.PseudoSelector.visible, options)); } (0, cypress_cucumber_preprocessor_1.When)('I find elements by role {string}', When_I_find_elements_by_role); /** * When I find element by role: * * ```gherkin * When I find element by role {string} * ``` * * Queries for the first element with the given role. * * @example * * ```gherkin * When I find element by role "progressbar" * ``` * * With [options](https://docs.cypress.io/api/commands/get#Arguments): * * ```gherkin * When I find element by role "progressbar" * | log | true | * | timeout | 4000 | * | withinSubject | null | * | includeShadowDom | false | * ``` * * @remarks * * This precedes steps like {@link When_I_click | "When I click"}. For example: * * ```gherkin * When I find element by role "progressbar" * And I click * ``` * * Inspired by Testing Library's [ByRole](https://testing-library.com/docs/queries/byrole/). * * @see * * - {@link When_I_find_elements_by_role | When I find elements by role} */ function When_I_find_element_by_role(role, options) { (0, utils_1.setCypressElement)((0, utils_1.getRoleElements)(role, constants_1.PseudoSelector.visible, options).first()); } (0, cypress_cucumber_preprocessor_1.When)('I find element by role {string}', When_I_find_element_by_role); //# sourceMappingURL=role.js.map