Docker上のSeleniumGridを使ってNightwatchでE2Eテストをするサンプルです
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
.gitignore first commit. Nov 23, 2016
README.md
docker-compose.yml first commit. Nov 23, 2016
globals_path.js first commit. Nov 23, 2016
nightwatch.conf.js first commit. Nov 23, 2016
package.json

README.md

Example for E2E test for use nightwatch by selenium-grid on docker.

Environment

  • node.js v7.2.0
  • docker v1.12.1
  • nightwatch v0.9.9

Install docker for mac or windows

Install docker for mac or windows.

[mac] https://docs.docker.com/docker-for-mac/

[windows] https://docs.docker.com/docker-for-windows/

Create docker-machine host for selenium

Create selenium docker host.

$ docker-machine create -d virtualbox selenium

Set environment.

$ eval $(docker-machine env selenium)

Clone this repository

git clone https://github.com/treetips/selenium-grid-nightwatch-example.git

Create and start selenium-hub and firefox-container and chrome container

$ docker-compose up -d

Usage

Install npm dependencies

$ npm install

Edit selenium host

You can check the docker-host with the docker-machine ip command.

$ docker-machine ip selenium
172.16.53.136

Open nightwatch.conf.js and edit selenium_host.

let DEFAULT_CONFIGURATION = {
    launch_url: "http://localhost",
    selenium_port: 4444,
    selenium_host: "172.16.53.136",

Run e2e test for local

If execute 'npm run local', start up local chrome or firefox by standalone-selenium without docker and selenium-grid.

# test for chrome
$ npm run local-chrome

# test for firefox
$ npm run local-firefox

# test for chrome and firefox
$ npm run local

Run e2e test for selenium-grid

If execute 'npm run grid', parallel start up chrome or firefox by selenium-grid on docker

$ npm run grid

Edit test suite

Edit src/test.js.