- Git
- NodeJS >= v8.x
- Google Maps API Key (necessary only for testing, you need to enable access to the following APIs: Google Maps Elevation API, Google Maps Embed API, Google Maps JavaScript API)
- Google Chrome (necessary only for testing)
- Install the following packages globally:
npm install -g browserify
npm install -g uglify-js
- Fetch dependencies for application:
npm install
- Fetch dependencies for test server:
cd server && npm install
To create output Javascript bundle file - routeVerifier.js you need to issue:
npm run bundle
That command takes all code from src directory and with use of browserify and uglify-js libraries creates routeVerifier.js and routeVerifier.js.min in server/static/js directory.
Tests are developed using NightwatchJS framework. All test-related code is stored in test subdirectory.
Test server is ExpressJS web server serving pages with KML routes visualization and automatic route verification sections.
The following steps shall be done to run test server:
- Create configuration file
config.jsonin server directory (see server/config.json.template for details) - Start test server:
npm start
- Open in browser:
http://localhost:7777/<route_id>, where<route_id>is name of KML file without extension.
NOTE: For the page to be displayed correctly <route_id>.kml must be present in resources path (defined in configuration file).
- Start server:
npm start
- Run tests:
npm test
or if you want to run specific test / test-case:
npm test -- --test './test/tests/<test-filename.js>' --test-case '<test-case-name>'
This section describes how to develop new tests.
-
Add resources
- Put
<route_id>.kml(input KML file) in resources directory - Put
<route_id>_route_params.json(route parameters response JSON) in resources directory
- Put
-
Create new test in test/tests directory
- For the automated verification testing - add new test-case in
verification.jstest file. All the available assertion commands are defined in page.js file - For the error handling - add new test-case in
errors.jstest file
- For the automated verification testing - add new test-case in
-
Run new test locally (see Execution section) or using CircleCI (see Continuous Integration section)
CircleCI web application is used as for CI management. See .circleci/config.yml file for details of the build and test job configuration.
You can create your own branch, push it remote and CI will start automatically. That way you can test your code even if you don't have local environment configured (NodeJS, Google Chrome, Google Maps API Key, etc.).