Skip to content

ministryofjustice/digital-prison-services

Folders and files

NameName
Last commit message
Last commit date
Nov 7, 2023
Jun 22, 2021
Sep 5, 2024
Sep 9, 2019
Sep 28, 2021
May 12, 2023
Sep 4, 2024
Jan 11, 2021
Sep 5, 2024
Apr 8, 2024
Nov 10, 2020
Feb 7, 2024
Oct 17, 2023
Jul 12, 2024
Jan 4, 2021
Jun 28, 2022
Nov 29, 2021
Jun 25, 2021
Oct 31, 2023
Oct 23, 2018
Oct 31, 2023
Dec 4, 2018
Nov 7, 2023
Jul 11, 2022
Sep 28, 2021
May 15, 2020
Aug 2, 2024
Jul 16, 2024
Aug 11, 2022
Oct 7, 2021
Oct 16, 2020
Sep 6, 2024
Sep 6, 2024
Oct 3, 2023
Oct 23, 2018
May 12, 2023
Jan 13, 2022

Repository files navigation

Digital Prison Services UI

Application can be built with for dev mode

npm install
npm run compile-sass
npm run start:dev

The application will automatically pick up front end changes and it will restart if there are any changes in /backend or /views. Other changes will require a manual restart.

Run locally as docker

docker run -p 3000:3000 -d \
     --name digital-prison-services \
     quay.io/hmpps/digital-prison-services:latest

Run remotely as docker

docker run -p 3000:3000 -d \
     --name digital-prison-services \
     -e API_ENDPOINT_URL=https://prison-api-dev.prison.service.justice.gov.uk/ \
     -e OAUTH_ENDPOINT_URL=https://sign-in-dev.hmpps.service.justice.gov.uk/auth/ \
     -e API_GATEWAY_TOKEN=<add here> \
     -e API_CLIENT_SECRET=<add here> \
     -e API_GATEWAY_PRIVATE_KEY=<add here> \
     quay.io/hmpps/digital-prison-services:latest

Cypress integration tests

The integration-tests directory contains a set of Cypress integration tests for the digital-prison-services application. These tests use WireMock to stub the application's dependencies on the prisonApi, oauth and whereabouts RESTful APIs.

Running the Cypress tests

You need to fire up the wiremock server first: docker compose -f docker-compose-test.yaml up

This will give you useful feedback if the app is making requests that you haven't mocked out. You can see the request log at localhost:9191/__admin/requests and a JSON representation of the mocks localhost:9191/__admin/mappings.

Starting feature tests node instance

A separate node instance needs to be started for the feature tests. This will run on port 3008 and won't conflict with any of the api services, e.g. prisonApi or oauth. It will also not conflict with the Groovy integration tests.

npm run start-feature --env=cypress.env

Note that the circleci will run start-feature-no-webpack instead, which will rely on a production webpack build rather than using the dev webpack against the assets.

Running the tests

With the UI:

npm run int-test-ui

Just on the command line (any console log outputs will not be visible, they appear in the browser the Cypress UI fires up):

npm run int-test

Useful links

Feature toggles

  • SOC API: This will enable/disable to ability to refer a prisoner to the SOC service and view their SOC profile if already referred. To enable the feature, change the environment variable of SOC_API_ENABLED to true. Any other value will disable the feature.
  • Neurodivergence accelerated prisons: To restrict access to neurodivergence information to nominated prisons only. This is a temporary measure agreed with stakeholders and to allow third party curiousApi provider time to rethink their API connections threshold. To enable the feature, add prison codes to the environment variable NEURODIVERSITY_ENABLED_PRISONS. For example, to allow access to only Moorland and Bristol: NEURODIVERSITY_ENABLED_PRISONS=MDI,BLI If left blank then all prisons will have access to the neurodivergence information.

Phase Name Banner

To show the phase name banner add the environment variable SYSTEM_PHASE=ENV_NAME. This will trigger the banner to become visible showing the given name.

Regenerating API typescript types

The types files for apis can be regenerated by first a command like this example for the Curious api:

npx openapi-typescript https://testservices.sequation.net/sequation-virtual-campus2-api/v3/api-docs --output backend/api/curious/types/index.d.ts

.. then formatting using prettier and reincorporating the local changes such as the enums and invalid type names.