README
@digest/nightwatch
@digest/nightwatch provides a Nightwatch
configuration which is extendable. @digest/nightwatch/dist/nightwatch.config.js
exports a config object that can be further modified. The default config
includes support for Firefox and Chrome.
Before running Nightwatch, the Selenium binaries
and browser drivers must be downloaded first. The binaries are installed within
node_modules
, so any time that directory is removed, they must be installed
again. An install script is included: @digest/nightwatch/dist/install.js
Nightwatch tests may be run after the binaries have been installed. The default
Nightwatch config will look for test files within the __e2e__
directory at the
root of the project.
Note: selenium requires Java be installed and JAVA_PATH
setup in the
local environment.
The following are examples using the provided default nightwatch
config:
"/package.json"
{
...
"scripts": {
"nightwatch:install": "node node_modules/@digest/nightwatch/dist/install.js",
"nightwatch": "sleep 1 && nightwatch --config node_modules/@digest/nightwatch/dist/nightwatch.config.js --env chrome",
"nightwatch:ci": "sleep 1 && SELENIUM_START=false nightwatch --config node_modules/@digest/nightwatch/dist/nightwatch.config.js --env chrome"
}
}
The provided Nightwatch configuration includes several optional configuration parameters:
webpack.digest.config.js | Environment Variable | Description | Default | Options |
---|---|---|---|---|
n/a | NODE_ENV | Use either production or development. Tests will only prompt user during development. | production |
|
n/a | PORT | The host port | Default 8080 , 8090 when NODE_ENV='development' |
|
baseHref | BASE_HREF | Set the provided default index.html base href path, e.g. <base href=''> . Also used by provided express and workbox configs. |
/ |
|
e2e | E2E | Path to end-to-end test files for Nightwatch | /__e2e__ |
|
headless | HEADLESS | Whether to run browsers in headless mode in selenium . Useful in CI environments. |
true |
|
reportPath | REPORT_PATH | Path to generate reports | /reports |
|
seleniumPort | SELENIUM_PORT | The selenium port | 4444 |
|
seleniumStart | SELENIUM_START | Whether to start selenium or not; for CI integration. | true |
Selenium continuous integration test patterns will vary from team to team.
webpack-digest
uses Atlassian's
docker-node-jdk-chrome-firefox
docker container. See this project's GitLab
CI and
package
scripts for examples.
License
GPLv3