Skip to content

Commit

Permalink
Merge pull request #1143 from ministryofjustice/feature/APS-1482__run…
Browse files Browse the repository at this point in the history
…_e2e_tests_against_dev_upstrem

Run e2e-tests locally against dev upstream services to simulate pipeline
  • Loading branch information
gregkhawkins authored Nov 19, 2024
2 parents 0e7a512 + 5b51be7 commit 7f7b207
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,31 @@ Spin up a real browser that gives you an interface to run individual E2E feature
npm run test:e2e:ui
```

#### End-to-End tests (via Cypress) using dev-upstream AP Tools
This enables us to locally simulate the e2e test run in the Circle-CI pipeline

First start the ap-tools using
```
ap-tools server stop --clear-databases
ap-tools server start --local-ui --local-api-dev-upstream
```

* The end-to-end tests run against our local API which then integrates with the dev upstream services and the dev database due to this param `-local-api-dev-upstream`
* Once AP is running successfully, we can run one of the two npm scripts below which both use the `e2e.dev-upstream.env` config file (instead of `e2e.local.env` config file)
* This ensures that when we run the e2e tests we pass the same env vars that the pipeline uses. For example, this ensures we the e2e tests login as the same dev users

Run E2E tests via a headless Chrome browser, with reporting matching that seen on CI:

```bash
npm run test:e2e-dev-upstream
```

Spin up a real browser that gives you an interface to run individual E2E features:

```bash
npm run test:e2e-dev-upstream:ui
```

## Release process

Our release process aligns with the other CAS teams and as such [lives in
Expand Down
7 changes: 7 additions & 0 deletions e2e.dev-upstream.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
CYPRESS_assessor_username=TEMPORARY-ACCOMMODATION-E2E-TESTER
CYPRESS_assessor_password=doesntmatter
CYPRESS_referrer_username=TEMPORARY-ACCOMMODATION-E2E-REFERRER
CYPRESS_referrer_password=doesntmatter
CYPRESS_acting_user_probation_region_id=db82d408-d440-4eb5-960b-119cb33427cd
CYPRESS_acting_user_probation_region_name=Kent,%20Surrey%20&%20Sussex
CYPRESS_environment=dev
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
"test:ci": "jest --runInBand",
"test:e2e": "export $(cat e2e.local.env) && cypress run -C cypress.config.e2e.ts --config baseUrl=http://localhost:3000",
"test:e2e:ui": "export $(cat e2e.local.env) && cypress open --e2e --browser chrome -C cypress.config.e2e.ts --config baseUrl=http://localhost:3000",
"test:e2e-dev-upstream": "export $(cat e2e.dev-upstream.env) && cypress run -C cypress.config.e2e.ts --config baseUrl=http://localhost:3000",
"test:e2e-dev-upstream:ui": "export $(cat e2e.dev-upstream.env) && cypress open --e2e --browser chrome -C cypress.config.e2e.ts --config baseUrl=http://localhost:3000",
"test:e2e:ci": "cypress run -C cypress.config.e2e.ts",
"test:integration": "npm run start-test-wiremock && start-server-and-test start-feature http://localhost:3007/ping int-test",
"test:integration:ui": "npm run start-test-wiremock && start-server-and-test start-feature:dev http://localhost:3007/ping int-test-ui",
Expand Down

0 comments on commit 7f7b207

Please sign in to comment.