UNPKG

cypress-cucumber-steps

Version:
66 lines 2.23 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.When_I_set_Cypress_config = When_I_set_Cypress_config; var cypress_cucumber_preprocessor_1 = require("@badeball/cypress-cucumber-preprocessor"); var utils_1 = require("../utils"); /** * When I set Cypress config: * * ```gherkin * When I set Cypress config {string} to {string} * ``` * * @example * * Increase time (in milliseconds) to wait until most DOM based commands are considered [timed out](https://docs.cypress.io/guides/references/configuration#Timeouts): * * ```gherkin * When I set Cypress config "defaultCommandTimeout" to "10000" * ``` * * Set multiple configuration options: * * ```gherkin * When I set Cypress config * | defaultCommandTimeout | 10000 | * ``` * * @remarks * * Configuration set using [`Cypress.config`](https://docs.cypress.io/api/cypress-api/config) _is only in scope for the current spec file_. * * Cypress runs each spec file in isolation: the browser is exited between specs. Configuration changed in one spec won't be visible in other specs. * * _Not all configuration values can be changed during runtime._ * * @see * * See [Cypress configuration options](https://docs.cypress.io/guides/references/configuration#Options). */ function When_I_set_Cypress_config(name, value) { if (name instanceof cypress_cucumber_preprocessor_1.DataTable) { var options = (0, utils_1.getOptions)(name); Cypress.config(options); return; } switch (value) { case 'true': Cypress.config(name, true); break; case 'false': Cypress.config(name, false); break; case 'null': Cypress.config(name, null); break; case 'undefined': Cypress.config(name, undefined); break; default: Cypress.config(name, isNaN(Number(value)) ? value : Number(value)); break; } } (0, cypress_cucumber_preprocessor_1.When)('I set Cypress config', When_I_set_Cypress_config); (0, cypress_cucumber_preprocessor_1.When)('I set Cypress config {string} to {string}', When_I_set_Cypress_config); //# sourceMappingURL=config.js.map