keystonejs / keystone-nightwatch-e2e

⚠️ Archived - Legacy end-to-end test framework for KeystoneJS applications.
https://keystonejs.github.io/keystone-nightwatch-e2e/javadoc/
MIT License
17 stars 7 forks source link

KNE uses too many global environment variables #34

Open webteckie opened 7 years ago

webteckie commented 7 years ago

KNE uses to many global environment variables making the code hard to reason about. A possible alternative may be to gather all settings that are required by the Nightwatch runner into a kneSettings export and require that in nightwatch.conf.js to apply directly to the settings. For example:

export kneSettings = {
  startSeleniumProcess: [true/false],
  browserName: <name>,
  browserVersion: <version>,
  etc.
}

Then in nightwatch.conf.js:

var kneSettings = require('.').kneSettings;

if (kneSettings.browserName) {
    settings.test_settings[process.env.KNE_TEST_ENV].desiredCapabilities.browserName = kneSettings.browserName;
}

...