The eApp project uses the nightwatch.js end-to-end test framework to perform automated browser-based feature specification testing via the Selenium/WebDriver server.
The eApp feature spec test suite is written using cucumber
syntax and the test cases are found in the e-QIP-prototype/spec/features directory in GitHub. Each .feature
file represents a test case covering a section of the eApp application form. For each section, there is a correspoinding step definition JavaScript file containing the code defining the test execution steps.
Running the feature specification test suite is an on-demand process and is run through docker-compose by specifying a different configuration file.
Follow these instructions to start the Selenium hub and run the automated feature tests.
docker-compose up
docker-compose -f nightwatch-compose.yml up hub chrome
docker-compose -f nightwatch-compose.yml run nightwatch /bin/bash
npm test -t features/**.feature
(where ** is the spec name)
E.g. to run the test cases related to the Foreign Activities section:
npm test -t features/foreign.feature
The shell running the test case will output the test case results:
If there is an error during the test run, you can find a screen capture of the browser state when the error occurred by using the rollowing URL:
file:///<<home>>/Code/go/src/github.com/18F/e-QIP-prototype/specs/screenshots/
(where <> is your home directory)
It is a good practice to clean up the docker containers after completing the test case runs, or after a code refresh.
docker-compose down
docker-compose -f nightwatch-compose.yml down
docker system prune
docker-compose ps