cypress-cucumber-steps
Version:
Cypress Cucumber step definitions
79 lines • 2.29 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.When_I_get_element_by_selector = When_I_get_element_by_selector;
exports.When_I_get_elements_by_selector = When_I_get_elements_by_selector;
var cypress_cucumber_preprocessor_1 = require("@badeball/cypress-cucumber-preprocessor");
var utils_1 = require("../utils");
/**
* When I get element by selector:
*
* ```gherkin
* When I get element by selector {string}
* ```
*
* Get the first DOM element by selector.
*
* @example
*
* Yield the first `<li>` in `.list`:
*
* ```gherkin
* When I get element by selector ".list > li"
* ```
*
* With [options](https://docs.cypress.io/api/commands/get#Arguments):
*
* ```gherkin
* When I get element by selector ".dropdown-menu"
* | log | true |
* | timeout | 4000 |
* | withinSubject | null |
* | includeShadowDom | false |
* ```
*
* @see
*
* - {@link When_I_get_elements_by_selector | When I get elements by selector}
* - {@link When_I_find_element_by_selector | When I find element by selector}
*/
function When_I_get_element_by_selector(selector, options) {
When_I_get_elements_by_selector(selector, options);
(0, utils_1.setCypressElement)((0, utils_1.getCypressElement)().first());
}
(0, cypress_cucumber_preprocessor_1.When)('I get element by selector {string}', When_I_get_element_by_selector);
/**
* When I get elements by selector:
*
* ```gherkin
* When I get elements by selector {string}
* ```
*
* Get DOM elements by selector.
*
* @example
*
* Yield all `<li>` in `.list`:
*
* ```gherkin
* When I get elements by selector ".list > li"
* ```
*
* With [options](https://docs.cypress.io/api/commands/get#Arguments):
*
* ```gherkin
* When I get element by selector ".dropdown-menu"
* | log | true |
* | timeout | 4000 |
* | withinSubject | null |
* | includeShadowDom | false |
* ```
*
* @see
*
* - {@link When_I_get_element_by_selector | When I get element by selector}
*/
function When_I_get_elements_by_selector(selector, options) {
(0, utils_1.setCypressElement)(cy.get(selector, (0, utils_1.getOptions)(options)));
}
(0, cypress_cucumber_preprocessor_1.When)('I get elements by selector {string}', When_I_get_elements_by_selector);
//# sourceMappingURL=get.js.map