cypress-cucumber-steps
Version:
Cypress Cucumber step definitions
223 lines • 7.84 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.When_I_find_elements_by_placeholder_text = When_I_find_elements_by_placeholder_text;
exports.When_I_find_element_by_placeholder_text = When_I_find_element_by_placeholder_text;
exports.When_I_find_inputs_by_placeholder_text = When_I_find_inputs_by_placeholder_text;
exports.When_I_find_input_by_placeholder_text = When_I_find_input_by_placeholder_text;
exports.When_I_find_textareas_by_placeholder_text = When_I_find_textareas_by_placeholder_text;
exports.When_I_find_textarea_by_placeholder_text = When_I_find_textarea_by_placeholder_text;
var cypress_cucumber_preprocessor_1 = require("@badeball/cypress-cucumber-preprocessor");
var utils_1 = require("../utils");
/**
* When I find elements by placeholder text:
*
* ```gherkin
* When I find elements by placeholder text {string}
* ```
*
* _A placeholder 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 element by placeholder text "Text"
* ```
*
* @remarks
*
* This precedes steps like {@link When_I_type | "When I type"}. For example:
*
* ```gherkin
* When I find elements by placeholder text "Name"
* And I get 1st element
* And I type "John Smith"
* ```
*
* Inspired by Testing Library's [ByPlaceholderText](https://testing-library.com/docs/queries/byplaceholdertext).
*
* @see
*
* - {@link When_I_find_element_by_placeholder_text | When I find element by placeholder text}
*/
function When_I_find_elements_by_placeholder_text(placeholderText) {
(0, utils_1.setCypressElement)(cy.get("[placeholder=".concat(JSON.stringify(placeholderText), "]:visible")));
}
(0, cypress_cucumber_preprocessor_1.When)('I find elements by placeholder text {string}', When_I_find_elements_by_placeholder_text);
/**
* When I find element by placeholder text:
*
* ```gherkin
* When I find element by placeholder text {string}
* ```
*
* _A placeholder 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 element by placeholder text "Text"
* ```
*
* @remarks
*
* This precedes steps like {@link When_I_type | "When I type"}. For example:
*
* ```gherkin
* When I find element by placeholder text "Name"
* And I type "John Smith"
* ```
*
* Inspired by Testing Library's [ByPlaceholderText](https://testing-library.com/docs/queries/byplaceholdertext).
*
* @see
*
* - {@link When_I_find_elements_by_placeholder_text | When I find elements by placeholder text}
*/
function When_I_find_element_by_placeholder_text(placeholderText) {
When_I_find_elements_by_placeholder_text(placeholderText);
(0, utils_1.setCypressElement)((0, utils_1.getCypressElement)().first());
}
(0, cypress_cucumber_preprocessor_1.When)('I find element by placeholder text {string}', When_I_find_element_by_placeholder_text);
/**
* When I find inputs by placeholder text:
*
* ```gherkin
* When I find inputs by placeholder text {string}
* ```
*
* _A placeholder is not a good substitute for a label so you should generally use {@link When_I_find_input_by_label_text | "When I find input by label text"} instead._
*
* @example
*
* ```gherkin
* When I find inputs by placeholder text "Text"
* ```
*
* @remarks
*
* This precedes steps like {@link When_I_type | "When I type"}. For example:
*
* ```gherkin
* When I find inputs by placeholder text "Password"
* And I get 1st element
* And I type "password"
* ```
*
* Inspired by Testing Library's [ByPlaceholderText](https://testing-library.com/docs/queries/byplaceholdertext).
*
* @see
*
* - {@link When_I_find_input_by_placeholder_text | When I find input by placeholder text}
*/
function When_I_find_inputs_by_placeholder_text(placeholderText) {
When_I_find_elements_by_placeholder_text(placeholderText);
(0, utils_1.setCypressElement)((0, utils_1.getCypressElement)().filter('input'));
}
(0, cypress_cucumber_preprocessor_1.When)('I find inputs by placeholder text {string}', When_I_find_inputs_by_placeholder_text);
/**
* When I find input by placeholder text:
*
* ```gherkin
* When I find input by placeholder text {string}
* ```
*
* _A placeholder is not a good substitute for a label so you should generally use {@link When_I_find_input_by_label_text | "When I find input by label text"} instead._
*
* @example
*
* ```gherkin
* When I find input by placeholder text "Text"
* ```
*
* @remarks
*
* This precedes steps like {@link When_I_type | "When I type"}. For example:
*
* ```gherkin
* When I find input by placeholder text "Password"
* And I type "password"
* ```
*
* Inspired by Testing Library's [ByPlaceholderText](https://testing-library.com/docs/queries/byplaceholdertext).
*
* @see
*
* - {@link When_I_find_inputs_by_placeholder_text | When I find inputs by placeholder text}
*/
function When_I_find_input_by_placeholder_text(placeholderText) {
When_I_find_inputs_by_placeholder_text(placeholderText);
(0, utils_1.setCypressElement)((0, utils_1.getCypressElement)().first());
}
(0, cypress_cucumber_preprocessor_1.When)('I find input by placeholder text {string}', When_I_find_input_by_placeholder_text);
/**
* When I find textareas by placeholder text:
*
* ```gherkin
* When I find textareas by placeholder text {string}
* ```
*
* _A placeholder is not a good substitute for a label so you should generally use {@link When_I_find_textarea_by_label_text | "When I find textarea by label text"} instead._
*
* @example
*
* ```gherkin
* When I find textareas by placeholder text "Text"
* ```
*
* @remarks
*
* This precedes steps like {@link When_I_type | "When I type"}. For example:
*
* ```gherkin
* When I find textareas by placeholder text "Comments"
* And I get 1st element
* And I type "Lorem ipsum"
* ```
*
* Inspired by Testing Library's [ByPlaceholderText](https://testing-library.com/docs/queries/byplaceholdertext).
*
* @see
*
* - {@link When_I_find_textarea_by_placeholder_text | When I find textarea by placeholder text}
*/
function When_I_find_textareas_by_placeholder_text(placeholderText) {
When_I_find_elements_by_placeholder_text(placeholderText);
(0, utils_1.setCypressElement)((0, utils_1.getCypressElement)().filter('textarea'));
}
(0, cypress_cucumber_preprocessor_1.When)('I find textareas by placeholder text {string}', When_I_find_textareas_by_placeholder_text);
/**
* When I find textarea by placeholder text:
*
* ```gherkin
* When I find textarea by placeholder text {string}
* ```
*
* _A placeholder is not a good substitute for a label so you should generally use {@link When_I_find_textarea_by_label_text | "When I find textarea by label text"} instead._
*
* @example
*
* ```gherkin
* When I find textarea by placeholder text "Text"
* ```
*
* @remarks
*
* This precedes steps like {@link When_I_type | "When I type"}. For example:
*
* ```gherkin
* When I find textarea by placeholder text "Comments"
* And I type "Lorem ipsum"
* ```
*
* Inspired by Testing Library's [ByPlaceholderText](https://testing-library.com/docs/queries/byplaceholdertext).
*
* @see
*
* - {@link When_I_find_textareas_by_placeholder_text | When I find textareas by placeholder text}
*/
function When_I_find_textarea_by_placeholder_text(placeholderText) {
When_I_find_textareas_by_placeholder_text(placeholderText);
(0, utils_1.setCypressElement)((0, utils_1.getCypressElement)().first());
}
(0, cypress_cucumber_preprocessor_1.When)('I find textarea by placeholder text {string}', When_I_find_textarea_by_placeholder_text);
//# sourceMappingURL=placeholder.js.map