Skip to content

Commit c28d087

Browse files
committed
CCM-7465: part of testing
1 parent 30095d5 commit c28d087

File tree

8 files changed

+20
-19
lines changed

8 files changed

+20
-19
lines changed

frontend/src/utils/validate-template.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export const validateEmailTemplate = (
5555
};
5656

5757
export const validateSubmittedEmailTemplate = (
58-
template: Template | undefined
58+
template: TemplateUnion
5959
): SubmittedEmailTemplate | undefined => {
6060
try {
6161
return $SubmittedEmailTemplate.parse(template);
@@ -66,7 +66,7 @@ export const validateSubmittedEmailTemplate = (
6666
};
6767

6868
export const validateSubmittedSMSTemplate = (
69-
template: Template | undefined
69+
template: TemplateUnion
7070
): SubmittedSMSTemplate | undefined => {
7171
try {
7272
return $SubmittedSMSTemplate.parse(template);
@@ -77,7 +77,7 @@ export const validateSubmittedSMSTemplate = (
7777
};
7878

7979
export const validateSubmittedNHSAppTemplate = (
80-
template: Template | undefined
80+
template: TemplateUnion
8181
): SubmittedNHSAppTemplate | undefined => {
8282
try {
8383
return $SubmittedNHSAppTemplate.parse(template);

tests/test-team/config/auth.setup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ setup('authenticate setup', async ({ page }) => {
1212

1313
await loginPage.cognitoSignIn(process.env.USER_EMAIL);
1414

15-
await page.waitForEvent('load');
15+
await page.waitForURL('/templates/create-and-submit-templates');
1616

1717
await page.context().storageState({ path: 'auth/user.json' });
1818
});

tests/test-team/config/auth.teardown.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,6 @@ teardown('authenticate teardown', async () => {
1111
const user = await userHelper.getUser(process.env.USER_EMAIL);
1212

1313
if (user) {
14-
// TODO: undo this
15-
// await userHelper.deleteUser(user.email);
14+
await userHelper.deleteUser(user.email);
1615
}
17-
18-
// TODO: delete this.
19-
console.log({
20-
USER_EMAIL: process.env.USER_EMAIL,
21-
USER_ID: process.env.USER_ID,
22-
USER_TEMPORARY_PASSWORD: process.env.USER_TEMPORARY_PASSWORD,
23-
USER_PASSWORD: process.env.USER_PASSWORD,
24-
});
2516
});

tests/test-team/config/local.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export default defineConfig({
1313
use: {
1414
baseURL: 'http://localhost:3000',
1515
...devices['Desktop Chrome'],
16+
headless: true,
1617
},
1718
},
1819
{

tests/test-team/helpers/sleep.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export function sleep(seconds: number): Promise<void> {
2+
return new Promise((resolve) => {
3+
setTimeout(resolve, seconds * 1000);
4+
});
5+
}

tests/test-team/helpers/template-storage-helper.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
PutCommand,
66
} from '@aws-sdk/lib-dynamodb';
77
import { Template } from './types';
8+
import { sleep } from './sleep';
89

910
export class TemplateStorageHelper {
1011
private readonly ddbDocClient: DynamoDBDocumentClient;
@@ -25,6 +26,9 @@ export class TemplateStorageHelper {
2526
);
2627

2728
await Promise.all(promises);
29+
30+
// Note: sleeping to allow DynamoDB some time to settle...
31+
await sleep(2);
2832
}
2933

3034
async deleteTemplateData() {

tests/test-team/template-mgmt-component-tests/sms/template-mgmt-preview-sms-page.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const templates = {
2626
},
2727
};
2828

29-
test.describe.only('Preview SMS message template Page', () => {
29+
test.describe('Preview SMS message template Page', () => {
3030
const templateStorageHelper = new TemplateStorageHelper(
3131
Object.values(templates)
3232
);

tests/test-team/template-mgmt-component-tests/template-mgmt-common.steps.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ export function assertNotifyBannerLink({
3737
});
3838
}
3939

40-
export function assertLoginLink({ page, id, baseURL }: CommonStepsProps) {
40+
export function assertLoginLink({ page, id }: CommonStepsProps) {
4141
return test.step('when user clicks "Log in", then user is redirected to "login page"', async () => {
4242
await page.loadPage(id);
4343

44-
await page.clickLoginLink();
44+
const link = await page.loginLink.getAttribute('href');
4545

46-
await expect(page.page).toHaveURL(
47-
`${baseURL}/auth?redirect=%2Ftemplates%2Fcreate-and-submit-templates`
46+
expect(link).toBe(
47+
'/auth?redirect=%2Ftemplates%2Fcreate-and-submit-templates'
4848
);
4949
});
5050
}

0 commit comments

Comments
 (0)