The frontend application for the Beacons Registration service enables:
- 406Mhz beacon owners to register their details with the Maritime & Coastguard Agency
- Search and rescue Mission Control Centres to retrieve information about beacons during distress signal activations
This directory contains the frontend application of the service. It is built using NextJS and based on the GOV.UK Design System.
This application depends on the Beacons Registration API.
Follow the instructions in the root README to get started.
Our approach to testing:
- Testing the rendering of React components. We use React testing library with Jest to ensure the rendered pages are what the user expects to see.
- Testing logic. We segregate frontend logic from components by defining reusable TypeScript functions in
src/lib/. Unit tests for these functions using Jest are intest/lib. - UI testing. We use Cypress to ensure the logic of the frontend matches the requirements.
- End-to-end testing. We also use Cypress to test the user journey from end to end.
npm run test-- Runs all unit tests in thetest/directorynpm run test:watch-- Runs unit tests in watch mode
docker compose up-- Start the app in production mode.npm run cypress:open-- Run Cypress tests in thecypress/integrationdirectory with the Cypress Test Runnernpm run cypress:watch-- Run Cypress tests with the Test Runner, with Cypress watching test files for changesnpm run cypress:run-- Run Cypress tests in thecypress/integrationdirectory in the command linenpm run cypress:run:firefox-- Run Cypress tests in thecypress/integrationdirectory using Firefox (requires Firefox to be installed)
The UI tests are a part of our CI/CD pipeline.
- The tests run in Chrome
- Web Security is disabled in our cypress config
- This is to work around the same superdomain limitation
- e.g. tests that access localhost as well as B2C
- Bring up the: Service, Database and Webapp
- Cypress needs the
SESSION_TOKENenvironment variable to be set- This value is set in env.local
- The value is in 1Password
npm run cypress:openornpm run cypress:watch-- Run Cypress tests in thecypress/endToEnddirectory with the Test Runnernpm run cypress:e2e-- Run Cypress tests in thecypress/endToEnddirectory in the command line
The end-to-end tests are also a part of our CI/CD pipeline
-
They require the env vars
SESSION_TOKEN,JWT_SECRETandWEBAPP_CLIENT_SECRET- These have been set as GitHub secrets in the repository
-
Currently, the values are the same as the ones used locally (
.env.local)- They're listed in 1Password in case the local or repository values change
-
If you are working on authentication pages, look at the auth documentation here.