Skip to content

Commit 1df2ebb

Browse files
committed
CCM-8873 Merge in main
2 parents 6298c1e + 30099ff commit 1df2ebb

File tree

6 files changed

+103
-3
lines changed

6 files changed

+103
-3
lines changed

infrastructure/terraform/components/app/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
|------|--------|---------|
5050
| <a name="module_amplify_branch"></a> [amplify\_branch](#module\_amplify\_branch) | git::https://github.com/NHSDigital/nhs-notify-shared-modules.git//infrastructure/modules/amp_branch | v1.0.0 |
5151
| <a name="module_backend_api"></a> [backend\_api](#module\_backend\_api) | ../../modules/backend-api | n/a |
52-
| <a name="module_eventpub"></a> [eventpub](#module\_eventpub) | git::https://github.com/NHSDigital/nhs-notify-shared-modules.git//infrastructure/modules/eventpub | v1.0.12 |
52+
| <a name="module_eventpub"></a> [eventpub](#module\_eventpub) | git::https://github.com/NHSDigital/nhs-notify-shared-modules.git//infrastructure/modules/eventpub | v1.0.13 |
5353
| <a name="module_kms"></a> [kms](#module\_kms) | git::https://github.com/NHSDigital/nhs-notify-shared-modules.git//infrastructure/modules/kms | v1.0.8 |
5454
| <a name="module_nhse_backup_vault"></a> [nhse\_backup\_vault](#module\_nhse\_backup\_vault) | git::https://github.com/NHSDigital/nhs-notify-shared-modules.git//infrastructure/modules/aws-backup-source | v1.0.8 |
5555
## Outputs

infrastructure/terraform/components/app/module_eventpub.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module "eventpub" {
2-
source = "git::https://github.com/NHSDigital/nhs-notify-shared-modules.git//infrastructure/modules/eventpub?ref=v1.0.12"
2+
source = "git::https://github.com/NHSDigital/nhs-notify-shared-modules.git//infrastructure/modules/eventpub?ref=v1.0.13"
33

44
name = "eventpub"
55

infrastructure/terraform/modules/backend-api/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ No requirements.
4141
| <a name="module_list_template_lambda"></a> [list\_template\_lambda](#module\_list\_template\_lambda) | ../lambda-function | n/a |
4242
| <a name="module_s3bucket_internal"></a> [s3bucket\_internal](#module\_s3bucket\_internal) | git::https://github.com/NHSDigital/nhs-notify-shared-modules.git//infrastructure/modules/s3bucket | v1.0.8 |
4343
| <a name="module_s3bucket_quarantine"></a> [s3bucket\_quarantine](#module\_s3bucket\_quarantine) | git::https://github.com/NHSDigital/nhs-notify-shared-modules.git//infrastructure/modules/s3bucket | v1.0.8 |
44+
| <a name="module_sftp_upload_queue"></a> [sftp\_upload\_queue](#module\_sftp\_upload\_queue) | git::https://github.com/NHSDigital/nhs-notify-shared-modules.git//infrastructure/modules/sqs | v1.0.8 |
4445
| <a name="module_sqs_quarantine_scan_enrichment"></a> [sqs\_quarantine\_scan\_enrichment](#module\_sqs\_quarantine\_scan\_enrichment) | git::https://github.com/NHSDigital/nhs-notify-shared-modules.git//infrastructure/modules/sqs | v1.0.8 |
4546
| <a name="module_sqs_virus_scan_failed_delete_object_dlq"></a> [sqs\_virus\_scan\_failed\_delete\_object\_dlq](#module\_sqs\_virus\_scan\_failed\_delete\_object\_dlq) | git::https://github.com/NHSDigital/nhs-notify-shared-modules.git//infrastructure/modules/sqs | v1.0.8 |
4647
| <a name="module_sqs_virus_scan_passed_copy_object_dlq"></a> [sqs\_virus\_scan\_passed\_copy\_object\_dlq](#module\_sqs\_virus\_scan\_passed\_copy\_object\_dlq) | git::https://github.com/NHSDigital/nhs-notify-shared-modules.git//infrastructure/modules/sqs | v1.0.8 |
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module "sftp_upload_queue" {
2+
source = "git::https://github.com/NHSDigital/nhs-notify-shared-modules.git//infrastructure/modules/sqs?ref=v1.0.8"
3+
4+
aws_account_id = var.aws_account_id
5+
component = var.component
6+
environment = var.environment
7+
project = var.project
8+
region = var.region
9+
name = "sftp-upload"
10+
11+
sqs_kms_key_arn = var.kms_key_arn
12+
13+
create_dlq = true
14+
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
import { test, expect } from '@playwright/test';
2+
import { TemplateStorageHelper } from '../../helpers/db/template-storage-helper';
3+
import { TemplateFactory } from '../../helpers/factories/template-factory';
4+
import { Template } from '../../helpers/types';
5+
import {
6+
createAuthHelper,
7+
TestUserId,
8+
} from '../../helpers/auth/cognito-auth-helper';
9+
import { TemplateMgmtPreviewLetterPage } from '../../pages/letter/template-mgmt-preview-letter-page';
10+
11+
async function createTemplates() {
12+
const user = await createAuthHelper().getTestUser(TestUserId.User1);
13+
return {
14+
empty: {
15+
id: 'preview-page-invalid-letter-template',
16+
version: 1,
17+
createdAt: new Date().toISOString(),
18+
updatedAt: new Date().toISOString(),
19+
templateType: 'LETTER',
20+
templateStatus: 'NOT_YET_SUBMITTED',
21+
owner: user.userId,
22+
} as Template,
23+
valid: TemplateFactory.createLetterTemplate(
24+
'valid-letter-preview-template',
25+
user.userId,
26+
'test-template-letter'
27+
),
28+
};
29+
}
30+
31+
test.describe('Preview Letter template Page', () => {
32+
let templates: { empty: Template; valid: Template };
33+
34+
const templateStorageHelper = new TemplateStorageHelper();
35+
36+
test.beforeAll(async () => {
37+
templates = await createTemplates();
38+
await templateStorageHelper.seedTemplateData(Object.values(templates));
39+
});
40+
41+
test.afterAll(async () => {
42+
await templateStorageHelper.deleteSeededTemplates();
43+
});
44+
45+
test('when user visits page, then page is loaded', async ({
46+
page,
47+
baseURL,
48+
}) => {
49+
const previewLetterTemplatePage = new TemplateMgmtPreviewLetterPage(page);
50+
51+
await previewLetterTemplatePage.loadPage(templates.valid.id);
52+
53+
await expect(page).toHaveURL(
54+
`${baseURL}/templates/${TemplateMgmtPreviewLetterPage.pageUrlSegment}/${templates.valid.id}`
55+
);
56+
57+
await expect(previewLetterTemplatePage.pageHeader).toContainText(
58+
'test-template-letter'
59+
);
60+
});
61+
62+
test.describe('Error handling', () => {
63+
test('when user visits page with missing data, then an invalid template error is displayed', async ({
64+
baseURL,
65+
page,
66+
}) => {
67+
const previewLetterTemplatePage = new TemplateMgmtPreviewLetterPage(page);
68+
69+
await previewLetterTemplatePage.loadPage(templates.empty.id);
70+
71+
await expect(page).toHaveURL(`${baseURL}/templates/invalid-template`);
72+
});
73+
74+
test('when user visits page with a fake template, then an invalid template error is displayed', async ({
75+
baseURL,
76+
page,
77+
}) => {
78+
const previewLetterTemplatePage = new TemplateMgmtPreviewLetterPage(page);
79+
80+
await previewLetterTemplatePage.loadPage('/fake-template-id');
81+
82+
await expect(page).toHaveURL(`${baseURL}/templates/invalid-template`);
83+
});
84+
});
85+
});

tests/test-team/template-mgmt-e2e-tests/template-mgmt-letter-file-validation.e2e.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ test.describe('letter file validation', () => {
8484
expect(csv?.ChecksumSHA256).toEqual(
8585
pdfUploadFixtures.withPersonalisation.csv.checksumSha256()
8686
);
87-
}).toPass({ timeout: 10_000 });
87+
}).toPass({ timeout: 100_000 });
8888
});
8989

9090
test('Uploaded pdf template files and test data csv files are virus scanned - if scan fails, files are deleted from quarantine and not copied, file and template status updated in database', async ({

0 commit comments

Comments
 (0)