diff --git a/README.md b/README.md index 4de37736..6df9b1c0 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ See https://github.com/UN-OCHA/hid-stack/blob/master/README.md + ## Code style guide This project aims to follow the [John Papa Angular 1 style guide](https://github.com/johnpapa/angular-styleguide/tree/master/a1) @@ -46,58 +47,51 @@ This project aims to follow the [John Papa Angular 1 style guide](https://github Unit tests are written using [Jasmine](https://jasmine.github.io/) and run with [Karma](https://karma-runner.github.io/). -### Pre-requisites - -Install Karma CLI - -``` +```sh +# install Karma CLI npm install -g karma-cli -``` -### Running the tests +# Run tests once +grunt test -Single run: `grunt test` +# Re-run tests when files are changed +grunt test-watch +``` -Watch for changes an re-run tests: `grunt test-watch` ## E2E tests -### Pre-requisites - -Protractor: +E2E is implemented with Protractor, an end-to-end testing tool for Angular. -``` -npm install -g protractor -``` +Installation on **host machine**: -webdriver-manager - -``` +```sh +# install E2E tools: first-time setup +yarn global add protractor webdriver-manager update ``` -Java Development Kit (JDK) http://www.oracle.com/technetwork/java/javase/downloads/index.html - -### Environment variables +Manually install [Java Development Kit (JDK)](https://www.oracle.com/technetwork/java/javase/downloads/index.html) You will need to add the environment variables to run the tests locally. * Ask Ops to share 'HID E2E test environment vars' with you on LastPass. -* Rename e2e-tests/enviroment.example.js to environment.js +* Copy `e2e-tests/enviroment.example.js` to `environment.js` * Replace the file's content with the variables from LastPass -### Running the tests +Finally, make sure you're running both containers (API/App) and they're both properly configured for local development. -``` -npm run protractor -``` +Now you can run the E2E tests: -Running a single test suite +```sh +# Run all E2E tests in series +yarn run protractor -``` +# Run a single E2E test suite protractor --suite="my-suite-name" src/e2e-tests/conf.js ``` + ### What to do if it fails on TravisCI The tests are prone to random failures on Travis. If this happens: @@ -122,6 +116,7 @@ As Test Admin E2E User: * Un-verify 'Test E2E user' * Cancel pending connection with 'Test E2E user' + ## Front end ### CSS diff --git a/src/e2e-tests/conf.js b/src/e2e-tests/conf.js index 312c15eb..9eb9c1e5 100644 --- a/src/e2e-tests/conf.js +++ b/src/e2e-tests/conf.js @@ -18,6 +18,21 @@ exports.config = { displayStacktrace: true } })); + }, + capabilities: { + browserName: 'chrome', + acceptInsecureCerts : true, + acceptSslCerts : true, + chromeOptions: { + args: [ + // '--headless', + // '--disable-gpu', + '--remember-cert-error-decisions', + '--ignore-certificate-errors', + '--reduce-security-for-testing', + '--allow-running-insecure-content', + ] + }, }, specs: ['specs/**/*-spec.js'], suites: {