Skip to content

Commit 882186d

Browse files
CCM-12666: Fix tests
1 parent 1cd5188 commit 882186d

File tree

3 files changed

+37
-8
lines changed

3 files changed

+37
-8
lines changed

tests/accessibility/.pa11y-ci.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ function previewLetterTemplateUrl(clientId, status) {
7676
}
7777

7878
const allTemplatesTests = [
79-
withSignIn(messageTemplatesPage(messageTemplatesUrl)),
80-
withSignIn(copyTemplatePage(chooseTemplateUrl)),
79+
withSignIn(messageTemplatesPage(messageTemplatesUrl), email, password),
80+
withSignIn(copyTemplatePage(chooseTemplateUrl), email, password),
8181
];
8282

8383
const chooseTemplateTests = [

tests/accessibility/pa11y-setup.ts

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,11 @@ const generateDigitalTemplateData = (
9696
const setupTestUser = async (
9797
testUserClient: TestUserClient,
9898
clientId: string,
99-
clientName: string
99+
clientName: string,
100+
features: {
101+
proofing: boolean;
102+
routing: boolean;
103+
}
100104
) => {
101105
const email = `nhs-notify-automated-test-accessibility-test-${randomUUID()}@nhs.net`;
102106
const password = generate({
@@ -112,7 +116,8 @@ const setupTestUser = async (
112116
email,
113117
password,
114118
clientId,
115-
clientName
119+
clientName,
120+
features,
116121
);
117122

118123
return {
@@ -172,6 +177,24 @@ const getTestTemplates = (clientId: string) => [
172177
'PASSED',
173178
'SUBMITTED'
174179
),
180+
generateDigitalTemplateData(
181+
'pa11y-email-proof-not-yetsubmitted',
182+
clientId,
183+
'EMAIL',
184+
'NOT_YET_SUBMITTED'
185+
),
186+
generateDigitalTemplateData(
187+
'pa11y-sms-proof-not-yet-submitted',
188+
clientId,
189+
'SMS',
190+
'NOT_YET_SUBMITTED'
191+
),
192+
generateDigitalTemplateData(
193+
'pa11y-nhsapp-proof-not-yet-submitted',
194+
clientId,
195+
'NHS_APP',
196+
'NOT_YET_SUBMITTED'
197+
),
175198
generateDigitalTemplateData(
176199
'pa11y-email-proof-submitted',
177200
clientId,
@@ -208,13 +231,15 @@ const setup = async () => {
208231
const mainUser = await setupTestUser(
209232
testUserClient,
210233
mainClientId,
211-
'NHS Accessibility'
234+
'NHS Accessibility',
235+
{ proofing: true, routing: false },
212236
);
213237

214238
const routingUser = await setupTestUser(
215239
testUserClient,
216240
routingClientId,
217-
'NHS Routing Accessibility'
241+
'NHS Routing Accessibility',
242+
{ proofing: true, routing: true },
218243
);
219244

220245
const ddbDocClient = DynamoDBDocumentClient.from(

tests/accessibility/test-user-client.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,21 @@ export class TestUserClient {
2828
password: string,
2929
clientId: string,
3030
clientName: string = 'NHS Client accessibility',
31+
features: {
32+
proofing: boolean;
33+
routing: boolean;
34+
},
3135
displayUsernameParts: [string, string] | [string, string, string] = [
3236
'Dr',
3337
'Test',
3438
'User',
35-
]
39+
],
3640
) {
3741
await this.ssmClient.send(
3842
new PutParameterCommand({
3943
Name: `${this.clientSsmPathPrefix}/${clientId}`,
4044
Value: JSON.stringify({
41-
features: { proofing: true },
45+
features,
4246
campaignIds: ['accessibility-test-campaign'],
4347
} satisfies ClientConfiguration),
4448
Overwrite: true,

0 commit comments

Comments
 (0)