cypress-cucumber-steps
Version:
Cypress Cucumber step definitions
88 lines • 2.55 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Then_I_see_testid = Then_I_see_testid;
exports.Then_I_do_not_see_testid = Then_I_do_not_see_testid;
var cypress_cucumber_preprocessor_1 = require("@badeball/cypress-cucumber-preprocessor");
var constants_1 = require("../constants");
var utils_1 = require("../utils");
/**
* Then I see test ID:
*
* ```gherkin
* Then I see test ID {string}
* ```
*
* Asserts `data-testid` or `data-test-id` **_exists_** and is **_visible_** in the screen:
*
* ```html
* <div data-testid="test"></div>
* <div data-test-id="test"></div>
* ```
*
* _Use this only if the other assertions don't work. `data-testid` or `data-test-id` don't resemble how your software is used and should be avoided if possible._
*
* @example
*
* ```gherkin
* Then I see test ID "testID"
* ```
*
* With [options](https://docs.cypress.io/api/commands/get#Arguments):
*
* ```gherkin
* Then I see test ID "testID"
* | log | true |
* | timeout | 4000 |
* | withinSubject | null |
* | includeShadowDom | false |
* ```
*
* @see
*
* - {@link Then_I_see_text | Then I see text}
*/
function Then_I_see_testid(text, options) {
(0, utils_1.getTestIdElements)(text, constants_1.PseudoSelector.visible, options).should('exist');
}
(0, cypress_cucumber_preprocessor_1.Then)('I see test ID {string}', Then_I_see_testid);
/**
* Then I do not see test ID:
*
* ```gherkin
* Then I do not see test ID {string}
* ```
*
* Asserts `data-testid` or `data-test-id` **_does not exist_** or **_is not visible_** in the screen:
*
* ```html
* <div data-testid="test"></div>
* <div data-test-id="test"></div>
* ```
*
* _Use this only if the other assertions don't work. `data-testid` or `data-test-id` don't resemble how your software is used and should be avoided if possible._
*
* @example
*
* ```gherkin
* Then I do not see test ID "testID"
* ```
*
* With [options](https://docs.cypress.io/api/commands/get#Arguments):
*
* ```gherkin
* Then I do not see test ID "testID"
* | log | true |
* | timeout | 4000 |
* | withinSubject | null |
* | includeShadowDom | false |
* ```
*
* @see
*
* - {@link Then_I_do_not_see_text | Then I do not see text}
*/
function Then_I_do_not_see_testid(text, options) {
(0, utils_1.getTestIdElements)(text, constants_1.PseudoSelector.visible, options).should('not.exist');
}
(0, cypress_cucumber_preprocessor_1.Then)('I do not see test ID {string}', Then_I_do_not_see_testid);
//# sourceMappingURL=testid.js.map