diff --git a/docs/basics.md b/docs/basics.md index d3cb25dca..9e02721fe 100644 --- a/docs/basics.md +++ b/docs/basics.md @@ -622,7 +622,7 @@ within('.js-signup-form', () => { I.see('There were problems creating your account.'); ``` -> ⚠ `within` can cause problems when used incorrectly. If you see a weired behavior of a test try to refactor it to not use `within`. It is recommended to keep within for simplest cases when possible. +> ⚠ `within` can cause problems when used incorrectly. If you see a weird behavior of a test try to refactor it to not use `within`. It is recommended to keep within for simplest cases when possible. `within` can also work with IFrames. A special `frame` locator is required to locate the iframe and get into its context. diff --git a/docs/configuration.md b/docs/configuration.md index f8edcaa58..17940cafe 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -118,7 +118,7 @@ exports.config = { ## Profile -Using values from `process.profile` you can change the config dynamically. +Using `process.env.profile` you can change the config dynamically. It provides value of `--profile` option passed to runner. Use its value to change config value on the fly. @@ -134,7 +134,7 @@ exports.config = { WebDriver: { url: 'http://localhost:3000', // load value from `profile` - browser: process.profile || 'firefox' + browser: process.env.profile || 'firefox' } } diff --git a/examples/codecept.conf.example.js b/examples/codecept.conf.example.js index 8f5d63510..da0bc889d 100644 --- a/examples/codecept.conf.example.js +++ b/examples/codecept.conf.example.js @@ -1,6 +1,6 @@ console.log('Use JS config file'); -console.log(process.profile); +console.log(process.env.profile); exports.config = { tests: './*_test.js', @@ -9,7 +9,7 @@ exports.config = { helpers: { WebDriverIO: { url: 'http://localhost', - browser: process.profile || 'firefox', + browser: process.env.profile || 'firefox', restart: true, }, }, diff --git a/lib/command/interactive.js b/lib/command/interactive.js index f49542487..a19245c63 100644 --- a/lib/command/interactive.js +++ b/lib/command/interactive.js @@ -6,7 +6,9 @@ const event = require('../event'); const output = require('../output'); module.exports = function (path, options) { + // Backward compatibility for --profile process.profile = options.profile; + process.env.profile = options.profile; const testsPath = getTestRoot(path); const config = getConfig(testsPath); diff --git a/lib/command/run-multiple.js b/lib/command/run-multiple.js index 8bf77b4e2..9265ae045 100644 --- a/lib/command/run-multiple.js +++ b/lib/command/run-multiple.js @@ -29,7 +29,7 @@ let processesDone; module.exports = function (selectedRuns, options) { // registering options globally to use in config - process.profile = options.profile; + process.env.profile = options.profile; const configFile = options.config; let codecept; diff --git a/lib/command/run-rerun.js b/lib/command/run-rerun.js index eee1f2b65..3b5e28df0 100644 --- a/lib/command/run-rerun.js +++ b/lib/command/run-rerun.js @@ -7,7 +7,9 @@ const Codecept = require('../rerun'); module.exports = function (test, options) { // registering options globally to use in config + // Backward compatibility for --profile process.profile = options.profile; + process.env.profile = options.profile; const configFile = options.config; let codecept; diff --git a/lib/command/run-workers.js b/lib/command/run-workers.js index cb8361134..1131c14f7 100644 --- a/lib/command/run-workers.js +++ b/lib/command/run-workers.js @@ -32,7 +32,7 @@ module.exports = function (workers, options) { 'Required minimum Node version of 11.7.0 to work with "run-workers"', ); - process.profile = options.profile; + process.env.profile = options.profile; const { Worker } = require('worker_threads'); diff --git a/lib/command/run.js b/lib/command/run.js index f9a65ee2f..33e56be97 100644 --- a/lib/command/run.js +++ b/lib/command/run.js @@ -10,7 +10,9 @@ const Codecept = require('../codecept'); module.exports = function (test, options) { // registering options globally to use in config + // Backward compatibility for --profile process.profile = options.profile; + process.env.profile = options.profile; const configFile = options.config; let codecept; diff --git a/test/data/sandbox/config.js b/test/data/sandbox/config.js index 460dea48c..7244343c9 100644 --- a/test/data/sandbox/config.js +++ b/test/data/sandbox/config.js @@ -1,4 +1,4 @@ -const profile = process.profile; +const profile = process.env.profile || process.profile; exports.config = { tests: './*_test.js',