This mock project will be a single page HTML report about various aspects of the Launchpad idea - Blockchain - Trade & Supply Chain Finance Platform
The project uses express as the web server and a static HTML built with boostrap.
Refer here to know more about the commit comments, branching, naming, merging, pull requests, reviews etc.
Clone this repo into new project folder (e.g., mock-bcts-proj
).
git clone https://github.com/CognizantStudio/mock-bcts.git mock-bcts-proj
cd mock-bcts-proj
Check for npm and nvm version. Preferred to have node version >= 6.9.X
Install the npm packages described in the package.json
and verify that it works:
npm install
npm start
We would be following Test-driven-development (TDD) / Behaviour-driven-developement (BDD) for this project using Nightwatch
Refer here to know more about Node Js end-to-end testing with Nightwatch.
The test scripts will be placed in tests folder
- Our tests requires selenium and so you need to have JDK installed in your machine. If not, please refer here
- Chrome version and selenium standalone server must be compatabile.
- Suggest to use the latest stable version of Chrome.
- ChromeDriver version be >= 2.27 or >= 2.28
- Chrome version must be >= 55.0.2883.0
- The necessary chromedriver and selenium jars are placed in the bin folder. This is only for local testing. For circleCI integration they aren't used.
- nightwatch-dev.json is the configuration while local testing
- nightwatch.json is the configuration for circleCI tests
E2E tests are in the tests
directory, Their filenames must end in .spec.js
.
Look for the example tests/spec.js
. Add more .spec.js
files as you wish (although one usually suffices for small projects);
We have configured Nightwatch to find them.
Thereafter, run them with npm run e2e
.
That command first compiles, then simultaneously starts the server
at localhost:3000
and launches selenium and then runs the nightwatch
to execute the tests.
The pass/fail test results appear at the bottom of the terminal window.
Nightwatch generates a report under reports
which is easier to read; this file is excluded from source control.
In case of any issues in the earlier method of e2e, we suggest to run the selenium-standalone server manually and then execute the tests. Also it was noticed that running the "cmd" in administrator mode crashes the chrome browser.
npm install -g selenium-standalone
selenium-standalone install --drivers.chrome.version=2.28
selenium-standalone start
npm run tests