Skip to content

Commit

Permalink
PI-2692 Initial screens to list and view notifications (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-bcl authored Jan 2, 2025
1 parent 128e0cf commit dddb36c
Show file tree
Hide file tree
Showing 28 changed files with 1,372 additions and 298 deletions.
11 changes: 3 additions & 8 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ on:
required: false
default: ''
type: string
push:
description: Push docker image to registry flag
required: true
default: false
type: boolean

permissions:
contents: read
Expand Down Expand Up @@ -56,7 +51,7 @@ jobs:
run: |
cp .env.example .env
npm run wiremock &
npm run start &
npm run dev-server &
timeout 10 sh -c 'until curl -s localhost:3000; do sleep 1; done'
- name: Run tests
run: npm run int-test
Expand All @@ -79,13 +74,13 @@ jobs:
environment: ${{ matrix.environment }}

docker_build:
if: github.ref_name == 'main'
if: github.ref_name == 'main' || github.event_name == 'workflow_dispatch'
uses: ministryofjustice/hmpps-github-actions/.github/workflows/docker_build.yml@v2
with:
docker_registry: 'ghcr.io'
registry_org: 'ministryofjustice'
additional_docker_tag: ${{ inputs.additional_docker_tag }}
push: ${{ inputs.push || true }}
push: true
docker_multiplatform: true

deploy_dev:
Expand Down
17 changes: 17 additions & 0 deletions assets/scss/local.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
.govuk-main-wrapper {
min-height: 600px;
}

.govuk-\!-width-auto {
width: auto !important;
}

.secondary-text {
color: $govuk-secondary-text-colour;
@include govuk-font-size($size: 16);
}

.moj-filter__header {
display: none;
}

.moj-filter__options .moj-datepicker input {
max-width: none;
}
19 changes: 11 additions & 8 deletions helm_deploy/hmpps-appointment-reminders-ui/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,29 +30,32 @@ generic-service:
REDIS_TLS_ENABLED: 'true'
TOKEN_VERIFICATION_ENABLED: 'true'
AUDIT_SQS_REGION: 'eu-west-2'
AUDIT_SERVICE_NAME: 'hmpps-appointment-reminders-ui' # Your audit service name
AUDIT_SERVICE_NAME: 'hmpps-appointment-reminders-ui'
AUDIT_ENABLED: 'true'

# Pre-existing kubernetes secrets to load as environment variables in the deployment.
namespace_secrets:
hmpps-appointment-reminders-ui:
hmpps-auth:
AUTH_CODE_CLIENT_ID: 'AUTH_CODE_CLIENT_ID'
AUTH_CODE_CLIENT_SECRET: 'AUTH_CODE_CLIENT_SECRET'
CLIENT_CREDS_CLIENT_ID: 'CLIENT_CREDS_CLIENT_ID'
CLIENT_CREDS_CLIENT_SECRET: 'CLIENT_CREDS_CLIENT_SECRET'
SESSION_SECRET: 'SESSION_SECRET'
govuk-notify:
NOTIFY_API_KEY: 'API_KEY'
elasticache-redis:
SESSION_SECRET: 'session_secret'
REDIS_HOST: 'primary_endpoint_address'
REDIS_AUTH_TOKEN: 'auth_token'
application-insights:
APPLICATIONINSIGHTS_CONNECTION_STRING: "APPLICATIONINSIGHTS_CONNECTION_STRING"
# This secret will need to be created in your namespace (note it isn't in hmpps-templates-dev)
# IRSA configuration in your namespace will also be required, and then uncomment serviceAccountName above.
# sqs-hmpps-audit-secret:
# AUDIT_SQS_QUEUE_URL: 'sqs_queue_url'
sqs-hmpps-audit-secret:
AUDIT_SQS_QUEUE_URL: 'sqs_queue_url'

allowlist:
groups:
- internal
- digital_staff_and_mojo
- unilink_staff
- probation

generic-prometheus-alerts:
targetApplication: hmpps-appointment-reminders-ui
1 change: 0 additions & 1 deletion helm_deploy/values-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ generic-service:
HMPPS_AUTH_URL: "https://sign-in-dev.hmpps.service.justice.gov.uk/auth"
TOKEN_VERIFICATION_API_URL: "https://token-verification-api-dev.prison.service.justice.gov.uk"
ENVIRONMENT_NAME: DEV
AUDIT_ENABLED: "false"

generic-prometheus-alerts:
alertSeverity: probation-integration-notifications
1 change: 0 additions & 1 deletion helm_deploy/values-preprod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ generic-service:
HMPPS_AUTH_URL: "https://sign-in-preprod.hmpps.service.justice.gov.uk/auth"
TOKEN_VERIFICATION_API_URL: "https://token-verification-api-preprod.prison.service.justice.gov.uk"
ENVIRONMENT_NAME: PRE-PRODUCTION
AUDIT_ENABLED: "false"

generic-prometheus-alerts:
alertSeverity: probation-integration-notifications
1 change: 0 additions & 1 deletion helm_deploy/values-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ generic-service:
INGRESS_URL: "https://appointment-reminders.hmpps.service.justice.gov.uk"
HMPPS_AUTH_URL: "https://sign-in.hmpps.service.justice.gov.uk/auth"
TOKEN_VERIFICATION_API_URL: "https://token-verification-api.prison.service.justice.gov.uk"
AUDIT_ENABLED: "false"

generic-prometheus-alerts:
alertSeverity: probation-integration-notifications
75 changes: 75 additions & 0 deletions integration_tests/e2e/list.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import Page from '../pages/page'
import IndexPage from '../pages'

context('List page', () => {
it('can filter results', () => {
cy.visit('/')
Page.verifyOnPage(IndexPage)

// Starts with 2 results
cy.get('#result-count').should('contain.text', 'Showing 2 results.')
cy.get('table tbody tr.govuk-table__row').should('have.length', 2)

// Filter on template + status
cy.get('#template').click()
cy.get('#status').click()
cy.get('#apply-filters-button').click()

// Now has 1 result, and 2 filters applied
cy.get('#result-count').should('contain.text', 'Showing 1 result.')
cy.get('table tbody tr.govuk-table__row').should('have.length', 1)
cy.get('.moj-filter__selected').should('exist').should('contain.text', 'Selected filters')
cy.get('.moj-filter__tag').should('have.length', 2)

// Remove first filter
cy.get('.moj-filter__tag').first().click()
cy.get('#result-count').should('contain.text', 'Showing 2 results.')
cy.get('table tbody tr.govuk-table__row').should('have.length', 2)
cy.get('.moj-filter__selected').should('exist').should('contain.text', 'Selected filters')
cy.get('.moj-filter__tag').should('have.length', 1)

// Clear all filters
cy.get('.moj-filter__heading-action a').click()
cy.get('.moj-filter__selected').should('not.exist')
cy.get('.moj-filter__tag').should('not.exist')
})

it('can search for keywords from message body', () => {
cy.visit('/')

cy.get('#keywords').type('test2')
cy.get('#apply-filters-button').click()

cy.get('#keywords').should('have.value', 'test2')
cy.get('#result-count').should('contain.text', 'Showing 1 result.')
cy.get('table tbody tr.govuk-table__row').should('have.length', 1).should('contain.text', 'Dear Test2')
})

it('can search for CRN', () => {
cy.visit('/')

cy.get('#keywords').type('A000001')
cy.get('#apply-filters-button').click()

cy.get('#keywords').should('have.value', 'A000001')
cy.get('#result-count').should('contain.text', 'Showing 1 result.')
cy.get('table tbody tr.govuk-table__row').should('have.length', 1).should('contain.text', 'A000001')
})

it('can search for phone number', () => {
cy.visit('/')

cy.get('#keywords').type('07700900000')
cy.get('#apply-filters-button').click()

cy.get('#keywords').should('have.value', '07700900000')
cy.get('#result-count').should('contain.text', 'Showing 1 result.')
cy.get('table tbody tr.govuk-table__row').should('have.length', 1).should('contain.text', '07700900000')
})

it('can navigate to notification screen', () => {
cy.visit('/')
cy.get('table tbody tr.govuk-table__row a').first().click()
cy.get('h1').should('have.text', 'Text message')
})
})
12 changes: 12 additions & 0 deletions integration_tests/e2e/notification.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
context('Notification page', () => {
it('displays message', () => {
cy.visit('/notification/00000000-0000-0000-0000-000000000001')
cy.get('body').should('contain.text', "'Unpaid Work Appointment Reminder' was sent to 07700900000.")
})

it('can navigate back to list screen', () => {
cy.visit('/notification/00000000-0000-0000-0000-000000000001')
cy.get('a.govuk-back-link').click()
cy.get('h1').should('have.text', 'Sent reminders')
})
})
2 changes: 1 addition & 1 deletion integration_tests/pages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Page, { PageElement } from './page'

export default class IndexPage extends Page {
constructor() {
super('This site is under construction...')
super('Sent reminders')
}

headerUserName = (): PageElement => cy.get('[data-qa=header-user-name]')
Expand Down
Loading

0 comments on commit dddb36c

Please sign in to comment.