UNPKG

cypress-cucumber-steps

Version:
140 lines 3.82 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Then_I_see_cookie = Then_I_see_cookie; exports.Then_I_see_cookie_has_value = Then_I_see_cookie_has_value; exports.Then_I_see_cookie_contains_value = Then_I_see_cookie_contains_value; exports.Then_I_do_not_see_cookie = Then_I_do_not_see_cookie; var cypress_cucumber_preprocessor_1 = require("@badeball/cypress-cucumber-preprocessor"); var utils_1 = require("../utils"); /** * Then I see cookie: * * ```gherkin * Then I see cookie {string} * ``` * * Assert cookie with name **_exists_**. * * @example * * ```gherkin * Then I see cookie "my-session-cookie" * ``` * * With [options](https://docs.cypress.io/api/commands/getcookie#Arguments): * * ```gherkin * Then I see cookie "my-session-cookie" * | domain | example.com | * | log | true | * | timeout | 3000 | * ``` * * @see * * - {@link Then_I_see_cookie_has_value | Then I see cookie has value} * - {@link Then_I_do_not_see_cookie | Then I do not see cookie} */ function Then_I_see_cookie(name, options) { cy.getCookie(name, (0, utils_1.getOptions)(options)).should('exist'); } (0, cypress_cucumber_preprocessor_1.Then)('I see cookie {string}', Then_I_see_cookie); /** * Then I see cookie has value: * * ```gherkin * Then I see cookie {string} has value {string} * ``` * * Assert cookie value has exact match. * * @example * * ```gherkin * Then I see cookie "name" has value "value" * ``` * * With [options](https://docs.cypress.io/api/commands/getcookie#Arguments): * * ```gherkin * Then I see cookie "name" has value "value" * | domain | example.com | * | log | true | * | timeout | 3000 | * ``` * * @see * * - {@link Then_I_see_cookie_contains_value | Then I see cookie contains value} */ function Then_I_see_cookie_has_value(name, value, options) { cy.getCookie(name, (0, utils_1.getOptions)(options)).should('have.property', 'value', value); } (0, cypress_cucumber_preprocessor_1.Then)('I see cookie {string} has value {string}', Then_I_see_cookie_has_value); /** * Then I see cookie contains value: * * ```gherkin * Then I see cookie {string} contains value {string} * ``` * * Assert cookie value has partial match. * * @example * * ```gherkin * Then I see cookie "name" contains value "value" * ``` * * With [options](https://docs.cypress.io/api/commands/getcookie#Arguments): * * ```gherkin * Then I see cookie "name" contains value "value" * | domain | example.com | * | log | true | * | timeout | 3000 | * ``` * * @see * * - {@link Then_I_see_cookie_has_value | Then I see cookie has value} */ function Then_I_see_cookie_contains_value(name, value, options) { cy.getCookie(name, (0, utils_1.getOptions)(options)).should(function (cookie) { expect(cookie === null || cookie === void 0 ? void 0 : cookie.value).to.contains(value); }); } (0, cypress_cucumber_preprocessor_1.Then)('I see cookie {string} contains value {string}', Then_I_see_cookie_contains_value); /** * Then I do not see cookie: * * ```gherkin * Then I do not see cookie {string} * ``` * * Assert cookie with name **_does not exist_**. * * @example * * ```gherkin * Then I do not see cookie "my-session-cookie" * ``` * * With [options](https://docs.cypress.io/api/commands/getcookie#Arguments): * * ```gherkin * Then I do not see cookie "my-session-cookie" * | domain | example.com | * | log | true | * | timeout | 3000 | * ``` * * @see * * - {@link Then_I_see_cookie | Then I see cookie} */ function Then_I_do_not_see_cookie(name, options) { cy.getCookie(name, (0, utils_1.getOptions)(options)).should('not.exist'); } (0, cypress_cucumber_preprocessor_1.Then)('I do not see cookie {string}', Then_I_do_not_see_cookie); //# sourceMappingURL=cookie.js.map