Skip to content

Commit a7102ed

Browse files
CCM-14974: Add failure reason and code to component test
1 parent 00037da commit a7102ed

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

tests/playwright/digital-letters-component-tests/report-generator.component.spec.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,27 +49,35 @@ const scenarios = [
4949
[EventStatus.DigitalPDMResourceSubmissionRejected],
5050
'Failed',
5151
senderId,
52+
'DL_PDMV_001',
53+
'Letter rejected by PDM',
5254
),
5355
new ReportScenario(
5456
'component-test-pdm-resource-retries-exceeded',
5557
CommunicationType.Digital,
5658
[EventStatus.DigitalPDMResourceRetriesExceeded],
5759
'Failed',
5860
senderId,
61+
'DL_PDMV_002',
62+
'Timeout waiting for letter storage',
5963
),
6064
new ReportScenario(
6165
'component-test-message-request-rejected',
6266
CommunicationType.Digital,
6367
[EventStatus.DigitalMessageRequestRejected],
6468
'Failed',
6569
senderId,
70+
'DL_INTE_001',
71+
'Request validation failed',
6672
),
6773
new ReportScenario(
6874
'component-test-digital-failed-priority',
6975
CommunicationType.Digital,
7076
[EventStatus.Unread, EventStatus.DigitalPDMResourceSubmissionRejected],
7177
'Failed',
7278
senderId,
79+
'DL_PDMV_001',
80+
'Letter rejected by PDM',
7381
),
7482
// Scenarios for communication type Print where there is a single event per message reference.
7583
new ReportScenario(
@@ -107,6 +115,8 @@ const scenarios = [
107115
[EventStatus.PrintFileQuarantined],
108116
'Failed',
109117
senderId,
118+
'DL_CLIV_003',
119+
'Attachment contains a virus',
110120
),
111121
// multiple events for the same message reference, should take the one with highest priority status (returned > failed > dispatched > rejected)
112122
new ReportScenario(

tests/playwright/helpers/report-helpers.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ export class ReportScenario {
8383

8484
readonly senderId: string;
8585

86+
readonly expectedReasonCode: string;
87+
88+
readonly expectedReason: string;
89+
8690
time: string;
8791

8892
constructor(
@@ -91,12 +95,16 @@ export class ReportScenario {
9195
eventStatuses: EventStatus[],
9296
expectedStatus: string,
9397
senderId: string,
98+
expectedReasonCode = '',
99+
expectedReason = '',
94100
) {
95101
this.messageReference = messageReference;
96102
this.communicationType = communicationType;
97103
this.eventStatuses = eventStatuses;
98104
this.expectedStatus = expectedStatus;
99105
this.senderId = senderId;
106+
this.expectedReasonCode = expectedReasonCode;
107+
this.expectedReason = expectedReason;
100108
this.time = ''; // Set when publishing the event to EventBridge, otherwise all the events would have the same timestamp.
101109
}
102110

@@ -106,6 +114,8 @@ export class ReportScenario {
106114
Time: this.time,
107115
'Communication Type': this.communicationType,
108116
Status: this.expectedStatus,
117+
'Reason Code': this.expectedReasonCode,
118+
Reason: this.expectedReason,
109119
};
110120
}
111121

0 commit comments

Comments
 (0)