Skip to content

Commit

Permalink
fixes typo
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherjturner committed Jan 5, 2024
1 parent 8035b99 commit bb7e3ee
Showing 1 changed file with 43 additions and 3 deletions.
46 changes: 43 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,49 @@

## Writing a test suite

- Update docker-compose.yaml
- Develop test suite with webdriver.io
- Connect
- Add your services to `docker-compose.yaml`
- Write some journey tests using [webdriver.io](https://webdriver.io/docs/gettingstarted)
- Configure `wdio.conf.js` to point at the service you want to test.
- Run your tests, by either:
- Running the [Journey Tests Workflow](https://github.com/DEFRA/cdp-node-journey-test-template/actions/workflows/run-tests.yaml) manually via Github actions
- Add calls to the [Journey Tests Workflow](https://github.com/DEFRA/cdp-node-journey-test-template/blob/main/.github/workflows/run-tests.yaml) to the service repositories covered by the test suite

### Updating docker-compose.yaml

The base docker-compose.yaml has an example service as well as some supporting infrastructure. These can be removed if not required.
All services built on the platform publish to DEFRA's dockerhub [https://github.com/DEFRA/](https://github.com/DEFRA/), you should use these images for testing as they're the same ones that will be deployed.

Service configuration should be done via environment variables, as it is in the real environments.

### Docker networking considerations

By default, docker compose will use bridged networking, meaning each container gets its own hostname/ip. Services should be configured to talk to each other using these hostnames.

A service can also expose specific ports to the host using the `ports` configuration. Typically, you'd do this for the frontend service you're testing.

You can consider using `host` networking mode, where all services appear on localhost, though this may be harder to develop if you're using Docker Desktop on Macs or Windows.

### How to trigger the test suite when a related service is built

You can use the `run-tests.yaml` workflow from this project as a reusable workflow to be called as a step in another workflow in another project.

The easiest way to do this is to cut and paste the following into `.github/workflows/journey-tests.yaml` in the github repository you want to run the test from:

```yaml
name: Jouney Tests

on:
workflow_dispatch:
workflow_run:
workflows: ['Publish']
types:
- completed
jobs:
test:
uses: defra/cdp-node-journey-test-template/.github/workflows/run-tests.yaml@main
```
This can be done for any number of services covered by your test suite, allowing for it to be run whenever any of those services publish a new version.
## Licence
Expand Down

0 comments on commit bb7e3ee

Please sign in to comment.