Skip to content
This repository has been archived by the owner on Feb 5, 2021. It is now read-only.

Commit

Permalink
HID-1819: README edits + config updates
Browse files Browse the repository at this point in the history
Making docs a little more dense so commands can be quickly
copy/pasted. Defined config for WD Chrome so that the current
local setup (along with its security issues) is automatically
compatible with the E2E script.
  • Loading branch information
rupl committed Jul 12, 2019
1 parent 6b8b0c3 commit 6a2b59c
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 28 deletions.
51 changes: 23 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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:
Expand All @@ -122,6 +116,7 @@ As Test Admin E2E User:
* Un-verify 'Test E2E user'
* Cancel pending connection with 'Test E2E user'


## Front end

### CSS
Expand Down
15 changes: 15 additions & 0 deletions src/e2e-tests/conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down

0 comments on commit 6a2b59c

Please sign in to comment.