Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ setup-root:
cd . && \
asdf install && \
node --version && \
npm install
npm install && \
npm run prepare

.PHONY: setup-backoffice
setup-backoffice:
Expand Down
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,22 @@ It comprises three applications:
- The SPA is served by Spring Boot.
- Application specific documentation is in the [README](./backoffice/README.md).

## Documentation available

We have the Beacons Runbook in Google Drive.

In this repository you can find:

- [The main README](./README.md)
- ??????

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do like if you ran tree | grep ".md".


## Testing

Application specific tests are covered in the READMEs linked to above.

If you are working towards a release, look at the [end-to-end and smoke test documentation](./tests/README.md).

Known issues and resolution for Unit, Integration and End-to-end testing are documented in the [tests README.md file](./tests/README.md).
Known issues and resolutions for Unit, Integration and End-to-end testing are documented in the [tests README.md file](./tests/README.md).

## Architecture

Expand Down Expand Up @@ -60,6 +69,11 @@ Before you start...
# From the root of this repository
make serve
```
- The application will be available at the following URLs:
- Webapp http://localhost:3000
- Backoffice http://localhost:3001

Todo: mention running the tests

## Infrastructure-as-code

Expand Down
31 changes: 28 additions & 3 deletions backoffice/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions tests/.env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Todo: Should be same as ../webapp/.env.local

WEBAPP_CLIENT_ID=1ccbe14d-00e3-43ac-a434-8f7a38e03366
WEBAPP_CLIENT_SECRET=change-me
AAD_TENANT_ID=513fb495-9a90-425b-a49a-bc6ebe2a429e
Expand Down
29 changes: 22 additions & 7 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,45 @@ the Beacons system, see the `../webapp/`, `../service/` and `../backoffice/` dir

## End-to-end testing

Automated end-to-end tests use [Cypress](https://www.cypress.io/) and are run in GitHub Actions against the publish images before deploying to the `dev` and `staging` environments.
Automated end-to-end tests use [Cypress](https://www.cypress.io/) and are run in GitHub Actions against the published images before deploying to the `dev` and `staging` environments.

To run end-to-end tests locally:

- Copy `tests/.env.example` as `tests/.env` and populate it with the contents of the "Beacons Webapp Local .env.local config" secure note in 1Password for the corresponding environment variables.

```sh
$ docker compose -f docker-compose.e2e.yml up
$ npm run test:e2e
```shell
docker compose -f docker-compose.e2e.yml up

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I ended up just running it with make serve and running the tests, I don't think we need this extra Docker Compose.

```

In another terminal window...

```shell
npm run test:e2e
```

### Occasional Cypress test failures

- Automated end-to-end tests require the `SESSION_TOKEN`, and may fail unexpectedly, due to rotating session tokens. To resolve this, log into local/dev/staging webapp using the test account. Locate the session token in dev tools: Application -> cookies -> \_\_Secure-next-auth.session-token -> value.
- Copy this value and update the corresponding secret in the GitHub repository.
Automated end-to-end tests require the `SESSION_TOKEN`, and may fail unexpectedly, due to rotating session tokens.

To resolve this:

- Log into local, dev or staging using the "Test B2C account" from 1Password.
- Locate the session token in dev tools: Application -> cookies -> \_\_Secure-next-auth.session-token -> value.
- Copy this value and update the corresponding secret:
- `SESSION_TOKEN` in your local `.env` files.
- `SESSION_TOKEN` in the "Beacons Webapp Local .env.local config" secure note in 1Password.
- `TEST_WEBAPP_AZURE_B2C_SESSION_TOKEN` in the GitHub Actions secrets.

## Integration testing

Todo: Does this belong in Service?

As part of our integration tests, a test user "test@test.com" is created in the Azure TEST tenancy. As a part of these tests, this user should be automatically deleted.
In the event that the test user is not deleted, the integration tests can fail:

- "Another object with the same value for property proxyAddresses already exists."

In order to remediate this failure, the "test@test.com" user will need to be deleted from the test tenancy. The tests should then succeed.
In order to remediate this failure, the "test@test.com" user will need to be deleted from the test B2C tenant in Azure. The tests should then succeed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's no longer hard coded, this can be deleted now.


## Smoke testing

Expand Down
Loading
Loading