/docker-nightwatch

Docker container for running nightwatch tests, based on https://bitbucket.org/rkrzewski/dockerfile/

Primary LanguageShell

Dockerfile for Nightwatch test execution

Based on caltha/protractor, this image contains a fully configured environment for running Nightwatch tests under the Chromium browser.

Installed software

  • Xvfb The headless X server, for running browsers inside Docker
  • node.js The runtime platform for running JavaScript on the server side, including Nightwatch tests
  • npm Node.js package manager used to install Nightwatch and any specific node.js modules the tests may need
  • Selenium webdriver Browser instrumentation agent used by Nightwatch to execute the tests
  • OpenJDK 8 JRE Needed by Selenium
  • Chromium The OSS core part of Google Chrome browser
  • Nightwatch An end-to-end test framework for web applications
  • Supervisor Process controll system used to manage Xvfb and Selenium background processes needed by Nightwatch

Running

In order to run tests from a CI system, execute the following:

docker build -t docker-nightwatch .
docker run --rm -v <test project location>:/project <docker id>

The container will terminate automatically after the tests are completed.

Your nightwatch.json must specify the no-sandbox option for Chrome to cleanly run inside Docker :

exports.config = {
    // ...
     "test_settings": {
        // ...
        "desiredCapabilities": {
            "browserName": "chrome",
            "marionette": true,
            "chromeOptions": {
                "args": [
                    "no-sandbox"
                ]
            }
        }
        // ...
    }
    // ...
};