cypress-cucumber-steps
Version:
Cypress Cucumber step definitions
173 lines • 4.62 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Then_I_see_value = Then_I_see_value;
exports.Then_I_do_not_see_value = Then_I_do_not_see_value;
exports.Then_I_see_input_value = Then_I_see_input_value;
exports.Then_I_see_input_value_contains = Then_I_see_input_value_contains;
exports.Then_I_see_textarea_value = Then_I_see_textarea_value;
exports.Then_I_see_textarea_value_contains = Then_I_see_textarea_value_contains;
var cypress_cucumber_preprocessor_1 = require("@badeball/cypress-cucumber-preprocessor");
var utils_1 = require("../utils");
/**
* Then I see value:
*
* ```gherkin
* Then I see value {string}
* ```
*
* Assert element with exact value is **_visible_** in the screen.
*
* @example
*
* ```gherkin
* Then I see value "Value"
* ```
*
* @remarks
*
* A preceding step like {@link When_I_find_input_by_label_text | "When I find input by label text"} is required. For example:
*
* ```gherkin
* When I find input by label text "Input"
* Then I see value "Value"
* ```
*/
function Then_I_see_value(value) {
(0, utils_1.getCypressElement)().should(function ($element) {
expect($element).value(value);
});
}
(0, cypress_cucumber_preprocessor_1.Then)('I see value {string}', Then_I_see_value);
/**
* Then I do not see value:
*
* ```gherkin
* Then I do not see value {string}
* ```
*
* Assert element with exact value **_does not exist_** in the screen.
*
* @example
*
* ```gherkin
* Then I do not see value "Value"
* ```
*
* @remarks
*
* A preceding step like {@link When_I_find_input_by_label_text | "When I find input by label text"} is required. For example:
*
* ```gherkin
* When I find input by label text "Input"
* Then I do not see value "Value"
* ```
*/
function Then_I_do_not_see_value(value) {
(0, utils_1.getCypressElement)().should(function ($element) {
expect($element.val()).to.not.equal(value);
});
}
(0, cypress_cucumber_preprocessor_1.Then)('I do not see value {string}', Then_I_do_not_see_value);
/**
* Then I see input value:
*
* ```gherkin
* Then I see input value {string}
* ```
*
* Assert first visible input has exact value.
*
* @example
*
* ```gherkin
* Then I see input value "Value"
* ```
*
* @see
*
* - {@link Then_I_see_input_value_contains | Then I see input value contains}
*/
function Then_I_see_input_value(value) {
cy.get('input:visible')
.filter(function (index, element) { return element.value === value; })
.should('exist');
}
(0, cypress_cucumber_preprocessor_1.Then)('I see input value {string}', Then_I_see_input_value);
/**
* Then I see input value contains:
*
* ```gherkin
* Then I see input value contains {string}
* ```
*
* Assert input with partial value is **_visible_** in the screen.
*
* @example
*
* ```gherkin
* Then I see input value contains "Value"
* ```
*
* @see
*
* - {@link Then_I_see_input_value | Then I see input value}
*/
function Then_I_see_input_value_contains(value) {
cy.get('input:visible')
.filter(function (index, element) { return element.value.includes(value); })
.should('exist');
}
(0, cypress_cucumber_preprocessor_1.Then)('I see input value contains {string}', Then_I_see_input_value_contains);
/**
* Then I see textarea value:
*
* ```gherkin
* Then I see textarea value {string}
* ```
*
* Assert textarea with exact value is **_visible_** in the screen.
*
* @example
*
* ```gherkin
* Then I see textarea value "Value"
* ```
*
* @see
*
* - {@link Then_I_see_textarea_value_contains | Then I see textarea value contains}
*/
function Then_I_see_textarea_value(value) {
cy.get('textarea:visible')
.filter(function (index, element) { return element.value === value; })
.should('exist');
}
(0, cypress_cucumber_preprocessor_1.Then)('I see textarea value {string}', Then_I_see_textarea_value);
/**
* Then I see textarea value contains:
*
* ```gherkin
* Then I see textarea value contains {string}
* ```
*
* Assert textarea with partial value is **_visible_** in the screen.
*
* @example
*
* ```gherkin
* Then I see textarea value contains "Value"
* ```
*
* @see
*
* - {@link Then_I_see_textarea_value | Then I see textarea value}
*/
function Then_I_see_textarea_value_contains(value) {
cy.get('textarea:visible')
.filter(function (index, element) {
return element.value.includes(value);
})
.should('exist');
}
(0, cypress_cucumber_preprocessor_1.Then)('I see textarea value contains {string}', Then_I_see_textarea_value_contains);
//# sourceMappingURL=value.js.map