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
9 changes: 8 additions & 1 deletion .github/actions/acceptance-tests/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,16 @@ runs:
TEST_TYPE: ${{ inputs.testType }}
ENVIRONMENT: ${{ inputs.targetEnvironment }}
PLAYWRIGHT_SHARD: ${{ inputs.shard }}
- name: Sanitise shard for artifact name
id: shard_label
if: ${{ inputs.testType == 'integration' && inputs.shard != '' }}
shell: bash
run: echo "value=${SHARD//\// of }" >> $GITHUB_OUTPUT
env:
SHARD: ${{ inputs.shard }}
- name: Archive integration test results
if: ${{ inputs.testType == 'integration' }}
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: Integration test report
name: Integration test report${{ inputs.shard != '' && format(' ({0})', steps.shard_label.outputs.value) || '' }}
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.

Taken for now from Ian's review to give the artifacts different name.

path: "tests/playwright/playwright-report"
2 changes: 1 addition & 1 deletion .github/workflows/stage-3-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,6 @@ jobs:
- name: "Checkout code"
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
- name: "Build docs"
uses: NHSDigital/nhs-notify-shared-modules/.github/actions/build-docs@3.0.0
uses: NHSDigital/nhs-notify-shared-modules/.github/actions/build-docs@3.1.6
with:
version: "${{ inputs.version }}"
4 changes: 3 additions & 1 deletion README.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ WITH vars AS (
OR e.type LIKE '%.queue.digital.letter.read.%'
OR e.type LIKE '%.pdm.resource.submission.rejected.%'
OR e.type LIKE '%.pdm.resource.retries.exceeded.%'
OR e.type LIKE '%.messages.request.rejected.%' THEN 'Digital'
OR e.type LIKE '%.messages.request.rejected.%'
OR e.type LIKE '%.queue.digital.letter.unsuccessful.%' THEN 'Digital'
WHEN e.type LIKE '%.print.letter.transitioned.%'
OR e.type LIKE '%.print.file.quarantined.%'
OR e.type LIKE '%.print.invalid.attachment.received.%' THEN 'Print' ELSE NULL
Expand All @@ -23,6 +24,7 @@ WITH vars AS (
WHEN e.type LIKE '%.messages.request.rejected.%' THEN 'Failed'
WHEN e.type LIKE '%.print.file.quarantined.%' THEN 'Failed'
WHEN e.type LIKE '%.print.invalid.attachment.received.%' THEN 'Failed'
WHEN e.type LIKE '%.queue.digital.letter.unsuccessful.%' THEN 'Failed'
WHEN e.letterstatus = 'RETURNED' THEN 'Returned'
WHEN e.letterstatus = 'FAILED' THEN 'Failed'
WHEN e.letterstatus = 'DELIVERED' THEN 'Delivered'
Expand All @@ -31,10 +33,12 @@ WITH vars AS (
e.reasoncode,
COALESCE(
CASE WHEN e.type LIKE '%.messages.request.rejected.%' THEN e.reasontext END,
CASE WHEN e.type LIKE '%.queue.digital.letter.unsuccessful.%' THEN e.reasontext END,
fcl.description,
e.reasontext,
e.reasoncode
) as reasontext
) as reasontext,
e.type
FROM event_record e
CROSS JOIN vars v
LEFT JOIN failure_code_lookup fcl ON e.reasoncode = fcl.code
Expand All @@ -49,8 +53,9 @@ WITH vars AS (
ORDER BY te.time DESC,
CASE
-- Digital Priority Order
WHEN te.communicationtype = 'Digital' AND te.status = 'Failed' THEN 3
WHEN te.status = 'Read' THEN 2
WHEN te.communicationtype = 'Digital' AND te.status = 'Failed' AND te.type NOT LIKE '%.messages.request.rejected.%' THEN 4
WHEN te.status = 'Read' THEN 3
WHEN te.communicationtype = 'Digital' AND te.status = 'Failed' THEN 2
WHEN te.status = 'Unread' THEN 1
-- Print Priority Order
WHEN te.status = 'Returned' THEN 4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ properties:
$ref: ../defs/requests.schema.yaml#/properties/messageReference
senderId:
$ref: ../defs/requests.schema.yaml#/properties/senderId
failureCode:
$ref: ../defs/core.schema.yaml#/properties/failureCode
failureReason:
$ref: ../defs/core.schema.yaml#/properties/failureReason
reasonCode:
$ref: ../defs/print.schema.yaml#/properties/reasonCode
reasonText:
$ref: ../defs/print.schema.yaml#/properties/reasonText
required:
- messageReference
- senderId
- failureCode
- failureReason
- reasonCode
- reasonText
21 changes: 15 additions & 6 deletions src/cloudevents/readme-index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# To regenerate, run: make update-readme
# To customize labels and purposes, edit: readme-metadata.yaml

generated: '2026-04-09T13:48:22.150Z'
generated: '2026-05-11T09:16:35.071Z'
common: null
domains:
- name: digital-letters
Expand Down Expand Up @@ -112,6 +112,11 @@ domains:
source: src/digital-letters/2025-10-draft/data/digital-letters-queue-digital-letter-read-data.schema.yaml
published: schemas/digital-letters/2025-10-draft/data/digital-letters-queue-digital-letter-read-data.schema.json
docs: ../../docs/cloudevents/digital-letters/2025-10-draft/data/digital-letters-queue-digital-letter-read-data.schema.md
- type: Digital Letters Queue Digital Letter Unsuccessful Data
category: data
source: src/digital-letters/2025-10-draft/data/digital-letters-queue-digital-letter-unsuccessful-data.schema.yaml
published: schemas/digital-letters/2025-10-draft/data/digital-letters-queue-digital-letter-unsuccessful-data.schema.json
docs: ../../docs/cloudevents/digital-letters/2025-10-draft/data/digital-letters-queue-digital-letter-unsuccessful-data.schema.md
- type: Digital Letters Queue Item Dequeued Data
category: data
source: src/digital-letters/2025-10-draft/data/digital-letters-queue-item-dequeued-data.schema.yaml
Expand Down Expand Up @@ -327,6 +332,11 @@ domains:
source: src/digital-letters/2025-10-draft/events/uk.nhs.notify.digital.letters.queue.digital.letter.read.v1.schema.yaml
published: schemas/digital-letters/2025-10-draft/events/uk.nhs.notify.digital.letters.queue.digital.letter.read.v1.schema.json
docs: ../../docs/cloudevents/digital-letters/2025-10-draft/events/uk.nhs.notify.digital.letters.queue.digital.letter.read.v1.schema.md
- type: uk.nhs.notify.digital.letters.queue.digital.letter.unsuccessful.v1
category: events
source: src/digital-letters/2025-10-draft/events/uk.nhs.notify.digital.letters.queue.digital.letter.unsuccessful.v1.schema.yaml
published: schemas/digital-letters/2025-10-draft/events/uk.nhs.notify.digital.letters.queue.digital.letter.unsuccessful.v1.schema.json
docs: ../../docs/cloudevents/digital-letters/2025-10-draft/events/uk.nhs.notify.digital.letters.queue.digital.letter.unsuccessful.v1.schema.md
- type: uk.nhs.notify.digital.letters.queue.item.dequeued.v1
category: events
source: src/digital-letters/2025-10-draft/events/uk.nhs.notify.digital.letters.queue.item.dequeued.v1.schema.yaml
Expand Down Expand Up @@ -357,11 +367,6 @@ domains:
source: src/digital-letters/2025-10-draft/nhs-notify-document-reference.schema.yaml
published: schemas/digital-letters/2025-10-draft/nhs-notify-document-reference.schema.json
docs: ../../docs/cloudevents/digital-letters/2025-10-draft/nhs-notify-document-reference.schema.md
- type: Profile
category: profile
source: src/digital-letters/2025-10-draft/supplierapi-profile.schema.yaml
published: schemas/digital-letters/2025-10-draft/supplierapi-profile.schema.json
docs: ../../docs/cloudevents/digital-letters/2025-10-draft/supplierapi-profile.schema.md
exampleEvents:
- name: Uk.nhs.notify.digital.letters.letter.available.v1
filename: uk.nhs.notify.digital.letters.letter.available.v1-event
Expand Down Expand Up @@ -439,6 +444,10 @@ domains:
filename: uk.nhs.notify.digital.letters.queue.digital.letter.read.v1-event
json: ../../docs/cloudevents/digital-letters/2025-10-draft/example-events/uk.nhs.notify.digital.letters.queue.digital.letter.read.v1-event.json
markdown: ../../docs/cloudevents/digital-letters/2025-10-draft/example-events/uk.nhs.notify.digital.letters.queue.digital.letter.read.v1-event.md
- name: Uk.nhs.notify.digital.letters.queue.digital.letter.unsuccessful.v1
filename: uk.nhs.notify.digital.letters.queue.digital.letter.unsuccessful.v1-event
json: ../../docs/cloudevents/digital-letters/2025-10-draft/example-events/uk.nhs.notify.digital.letters.queue.digital.letter.unsuccessful.v1-event.json
markdown: ../../docs/cloudevents/digital-letters/2025-10-draft/example-events/uk.nhs.notify.digital.letters.queue.digital.letter.unsuccessful.v1-event.md
- name: Uk.nhs.notify.digital.letters.queue.item.dequeued.v1
filename: uk.nhs.notify.digital.letters.queue.item.dequeued.v1-event
json: ../../docs/cloudevents/digital-letters/2025-10-draft/example-events/uk.nhs.notify.digital.letters.queue.item.dequeued.v1-event.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,35 @@ const scenarios = [
'Unread',
senderId,
),
new ReportScenario(
'component-test-digitalLetterUnsuccessful',
CommunicationType.Digital,
[EventStatus.DigitalLetterNhsAppUnsuccessful],
'Failed',
senderId,
'DL_INTE_001',
'Failed enrichment',
),
new ReportScenario(
'component-test-itemDequeued-digitalLetterUnsuccessful',
CommunicationType.Digital,
[EventStatus.Unread, EventStatus.DigitalLetterNhsAppUnsuccessful],
'Failed',
senderId,
'DL_INTE_001',
'Failed enrichment',
),
new ReportScenario(
'component-test-digitalLetterRead-digitalLetterUnsuccessful',
CommunicationType.Digital,
[
EventStatus.Unread,
EventStatus.Read,
EventStatus.DigitalLetterNhsAppUnsuccessful,
],
'Unread',
senderId,
),
new ReportScenario(
'component-test-itemDequeued-digitalLetterRead',
CommunicationType.Digital,
Expand Down
23 changes: 23 additions & 0 deletions tests/playwright/helpers/event-builders.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
DigitalLetterRead,
DigitalLetterUnsuccessful,
FileQuarantined,
InvalidAttachmentReceived,
ItemDequeued,
Expand Down Expand Up @@ -163,6 +164,28 @@ export function buildMessageRequestRejectedEvent(
} as MessageRequestRejected;
}

export function buildDigitalLetterUnsuccessfulEvent(
eventId: string,
time: string,
messageReference: string,
senderId: string,
): DigitalLetterUnsuccessful {
const baseEvent = buildBaseEvent('queue', time);
return {
...baseEvent,
id: eventId,
type: 'uk.nhs.notify.digital.letters.queue.digital.letter.unsuccessful.v1',
dataschema:
'https://notify.nhs.uk/cloudevents/schemas/digital-letters/2025-10-draft/data/digital-letters-queue-digital-letter-unsuccessful-data.schema.json',
data: {
messageReference,
senderId,
reasonCode: 'DL_INTE_001',
reasonText: 'Failed enrichment',
},
} as DigitalLetterUnsuccessful;
}

export function buildFileQuarantinedEvent(
eventId: string,
time: string,
Expand Down
18 changes: 18 additions & 0 deletions tests/playwright/helpers/report-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { v4 as uuidv4 } from 'uuid';

import {
DigitalLetterRead,
DigitalLetterUnsuccessful,
FileQuarantined,
GenerateReport,
InvalidAttachmentReceived,
Expand All @@ -21,6 +22,7 @@ import {
PDMResourceSubmissionRejected,
PrintLetterTransitioned,
validateDigitalLetterRead,
validateDigitalLetterUnsuccessful,
validateFileQuarantined,
validateGenerateReport,
validateInvalidAttachmentReceived,
Expand All @@ -41,6 +43,7 @@ import eventPublisher from 'helpers/event-bus-helpers';
import expectToPassEventually from 'helpers/expectations';
import {
buildDigitalLetterReadEvent,
buildDigitalLetterUnsuccessfulEvent,
buildFileQuarantinedEvent,
buildInvalidAttachmentReceivedEvent,
buildItemDequeuedEvent,
Expand Down Expand Up @@ -72,6 +75,7 @@ export enum EventStatus {
DigitalMessageRequestRejected = 'MessageRequestRejected',
PrintFileQuarantined = 'FileQuarantined',
PrintInvalidAttachmentReceived = 'InvalidAttachmentReceived',
DigitalLetterNhsAppUnsuccessful = 'DigitalLetterNhsAppUnsuccessful',
}
/**
* Utility class to proof the SQL logic to determine which status should be reported for a given message reference,
Expand Down Expand Up @@ -207,6 +211,20 @@ export function publishEventForScenario(scenario: ReportScenario) {
);
break;
}
case EventStatus.DigitalLetterNhsAppUnsuccessful: {
eventPublisher.sendEvents<DigitalLetterUnsuccessful>(
[
buildDigitalLetterUnsuccessfulEvent(
uuidv4(),
scenario.time,
scenario.messageReference,
scenario.senderId,
),
],
validateDigitalLetterUnsuccessful,
);
break;
}
default:
}
break;
Expand Down
Loading