Frontend for the Knowledge Based Verification Credential Issuer
This is the home for the front end user interface for a credential issuer as a part of the Identity Proofing and Verification (IPV) system within the GDS digital identity platform. Other repositories are used for core services or other credential issuers.
Clone this repository and then run
yarn install
Install pre-commit
from here
Run pre-commit install
to install pre-commit hooks locally.
If you get the error:
[ERROR] Cowardly refusing to install hooks with `core.hooksPath` set.
Run git config --unset-all core.hooksPath
to reset your git hook settings.
- 'BASE_URL': Externally accessible base url of the webserver. Used to generate the callback url as part of credential issuer oauth flows
PORT
- Default port to run webserver on. (Default to5020
)GA4_DISABLED
- Feature flag to disable GA4, defaulted tofalse
UA_DISABLED
- Feature flag to disable UA, defaulted totrue
UA_CONTAINER_ID
- Container ID for Universal Analytics, required for UA to work correctly. Default value isGTM-TK92W68
GA4_CONTAINER_ID
- Container ID for GA4, required for analytics to work correctly. Default value isGTM-KD86CMZ
ANALYTICS_COOKIE_DOMAIN
- Cookie domain to persist values throughout the different sections of the OneLogin journey. Default value islocalhost
LANGUAGE_TOGGLE_DISABLED
- Feature flag to disable Language Toggle, defaulted totrue
Wiremock has been used to create a stateful mock of the API, through the use of scenarios. These configuration files are stored as JSON files in the ./test/mocks/mappings directory.
This can be run by using:
yarn run mock
The frontend can be configured to use this mock server through two environment variables:
NODE_ENV = development
- this enables a middleware that passes thex-scenario-id
header from web requests through to the APIAPI_BASE_URL = http://localhost:8090
- this points the frontend at the Wiremock instance
A browser extension, such as Mod Header, can be used to set the value of this header in a web browser.
In order to support consistent use of headers for API requests, middleware is applied to add an instance of
axios on each request onto req.axios
. This is then reused in any code that uses the API.
Browser based tests can be run against the mock server, and should be able to be run against an instance of the API.
These tests are written using Cucumber as the test runner and Playwright as the automation tool. They also follow the Page Object Model for separation of concerns.
They can be run by using:
yarn run test:browser
Any cucumber feature or scenario with a tag prefixed with @mock-api:
e.g.
@mock-api:question-error
Scenario: API error
...
This scenario will be configured to send a scenario-id
header of question-error
on every web browser request.
This repo has a CODEOWNERS
file in the root and is configured to require PRs to reviewed by Code Owners.