End-to-end Testing
This boilerplate uses Nightwatch.js for e2e tests. Nightwatch.js is a highly integrated e2e test runner built on top of Selenium. This boilerplate comes with Selenium server and chromedriver binaries pre-configured for you, so you don't have to mess with these yourself.
Let's take a look at the files in the test/e2e
directory:
runner.js
A Node.js script that starts the dev server, and then launches Nightwatch to run tests against it. This is the script that will run when you run
npm run e2e
.nightwatch.conf.js
Nightwatch configuration file. See Nightwatch's docs on configuration for more details.
custom-assertions/
Custom assertions that can be used in Nightwatch tests. See Nightwatch's docs on writing custom assertions for more details.
specs/
Your actual tests! See Nightwatch's docs on writing tests and API reference for more details.
Running Tests in More Browsers
To configure which browsers to run the tests in, add an entry under "test_settings" in test/e2e/nightwatch.conf.js
, and also the --env
flag in test/e2e/runner.js
. If you wish to configure remote testing on services like SauceLabs, you can either make the Nightwatch config conditional based on environment variables, or use a separate config file altogether. Consult Nightwatch's docs on Selenium for more details.