Skip to content

Commit 2792a7f

Browse files
committed
comments
1 parent fdb0a22 commit 2792a7f

File tree

9 files changed

+37
-17
lines changed

9 files changed

+37
-17
lines changed

frontend/src/__tests__/app/message-plans/page.test.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,6 @@ describe('MessagePlansPage', () => {
7474
typeof MessagePlans
7575
>;
7676

77-
expect(page.props).toBeDefined();
78-
7977
expect(getRoutingConfigsMock).toHaveBeenCalledTimes(1);
8078

8179
expect(countRoutingConfigsMock).toHaveBeenNthCalledWith(1, 'DRAFT');

frontend/src/__tests__/components/molecules/__snapshots__/MessagePlans.test.tsx.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ exports[`MessagePlans matches snapshot 1`] = `
1818
</h1>
1919
<details
2020
class="nhsuk-details"
21-
id="message-plans-status-info"
21+
data-testid="message-plans-status-info"
2222
>
2323
<summary
2424
class="nhsuk-details__summary"
@@ -89,9 +89,9 @@ exports[`MessagePlans matches snapshot 1`] = `
8989
<a
9090
aria-disabled="false"
9191
class="nhsuk-button"
92+
data-testid="create-message-plan-button"
9293
draggable="false"
9394
href="/message-plans/choose-message-order"
94-
id="create-message-plan-button"
9595
role="button"
9696
>
9797
New message plan

frontend/src/__tests__/components/molecules/__snapshots__/MessagePlansList.test.tsx.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ exports[`MessagePlansList matches snapshot when data is available 1`] = `
44
<DocumentFragment>
55
<details
66
class="nhsuk-details nhsuk-expander"
7-
id="message-plans-list-draft"
7+
data-testid="message-plans-list-draft"
88
>
99
<summary
1010
class="nhsuk-details__summary nhsuk-heading-s nhsuk-u-margin-bottom-0"
@@ -117,7 +117,7 @@ exports[`MessagePlansList matches snapshot when no data is available 1`] = `
117117
<DocumentFragment>
118118
<details
119119
class="nhsuk-details nhsuk-expander"
120-
id="message-plans-list-draft"
120+
data-testid="message-plans-list-draft"
121121
>
122122
<summary
123123
class="nhsuk-details__summary nhsuk-heading-s nhsuk-u-margin-bottom-0"

frontend/src/__tests__/utils/form-actions.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ describe('form-actions', () => {
785785
},
786786
];
787787

788-
// a487ed49-e2f7-4871-ac8d-0c6c682c71f5 is the newest, 8f5157fe-72d7-4a9c-818f-77c128ec8197 is the oldest.
788+
// a48... is the newest, 8f5... is the oldest.
789789
// the others all have the same createdAt.
790790
const expectedOrder = [
791791
'a487ed49-e2f7-4871-ac8d-0c6c682c71f5',

frontend/src/components/molecules/MessagePlans/MessagePlans.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export const MessagePlans = (props: MessagePlansProps) => {
3535
<div className='nhsuk-grid-row'>
3636
<div className='nhsuk-grid-column-full'>
3737
<h1>{pageHeading}</h1>
38-
<Details id='message-plans-status-info'>
38+
<Details data-testid='message-plans-status-info'>
3939
<Details.Summary>{draftAndProdHeading}</Details.Summary>
4040
<Details.Text>
4141
{draftAndProductionInfo.map(
@@ -56,7 +56,9 @@ export const MessagePlans = (props: MessagePlansProps) => {
5656
</Details.Text>
5757
</Details>
5858
<Link passHref legacyBehavior href={button.link}>
59-
<Button id='create-message-plan-button'>{button.text}</Button>
59+
<Button data-testid='create-message-plan-button'>
60+
{button.text}
61+
</Button>
6062
</Link>
6163
<MessagePlansList
6264
status='DRAFT'

frontend/src/components/molecules/MessagePlansList/MessagePlansList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export const MessagePlansList = (props: MessagePlansListProps) => {
5959
));
6060

6161
return (
62-
<Details expander id={`message-plans-list-${statusDisplayLower}`}>
62+
<Details expander data-testid={`message-plans-list-${statusDisplayLower}`}>
6363
<Details.Summary
6464
className={classNames('nhsuk-heading-s', 'nhsuk-u-margin-bottom-0')}
6565
>

lambdas/backend-client/src/__tests__/routing-config-api-client.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ describe('RoutingConfigurationApiClient', () => {
4242
expect(axiosMock.history.get.length).toBe(1);
4343
});
4444

45-
it('should return number of routing configuration', async () => {
45+
it('should return number of routing configurations', async () => {
4646
axiosMock
4747
.onGet('/v1/routing-configurations/count', {
4848
params: { status: 'COMPLETED' },
@@ -86,7 +86,7 @@ describe('RoutingConfigurationApiClient', () => {
8686
expect(axiosMock.history.get.length).toBe(1);
8787
});
8888

89-
it('should return list of routing configuration', async () => {
89+
it('should return list of routing configurations', async () => {
9090
const data = {
9191
campaignId: 'campaignId',
9292
cascade: [],

tests/test-team/pages/routing-message-plans-page.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ export class RoutingMessagePlansPage extends TemplateMgmtBasePageNonDynamic {
1414

1515
constructor(page: Page) {
1616
super(page);
17-
this.messagePlanStatusInfo = page.locator('#message-plans-status-info');
18-
this.newMessagePlanButton = page.locator('#create-message-plan-button');
19-
this.draftMessagePlansTable = page.locator('#message-plans-list-draft');
20-
this.productionMessagePlansTable = page.locator(
21-
'#message-plans-list-production'
17+
this.messagePlanStatusInfo = page.getByTestId('message-plans-status-info');
18+
this.newMessagePlanButton = page.getByTestId('create-message-plan-button');
19+
this.draftMessagePlansTable = page.getByTestId('message-plans-list-draft');
20+
this.productionMessagePlansTable = page.getByTestId(
21+
'message-plans-list-production'
2222
);
2323
}
2424

tests/test-team/template-mgmt-routing-component-tests/message-plans.routing-component.spec.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,16 @@ test.describe('Message plans Page', () => {
6161
const messagePlanPage = new RoutingMessagePlansPage(page);
6262
await messagePlanPage.loadPage();
6363

64+
await expect(messagePlanPage.draftMessagePlansTable).not.toHaveAttribute(
65+
'open'
66+
);
67+
68+
await messagePlanPage.draftMessagePlansTable.click();
69+
70+
await expect(messagePlanPage.draftMessagePlansTable).toHaveAttribute(
71+
'open'
72+
);
73+
6474
const draftIdCells = messagePlanPage.draftMessagePlansTable.getByTestId(
6575
'message-plan-id-cell'
6676
);
@@ -84,6 +94,16 @@ test.describe('Message plans Page', () => {
8494
)
8595
).toBeUndefined();
8696

97+
await expect(
98+
messagePlanPage.productionMessagePlansTable
99+
).not.toHaveAttribute('open');
100+
101+
await messagePlanPage.productionMessagePlansTable.click();
102+
103+
await expect(messagePlanPage.productionMessagePlansTable).toHaveAttribute(
104+
'open'
105+
);
106+
87107
const productionIdCells =
88108
messagePlanPage.productionMessagePlansTable.getByTestId(
89109
'message-plan-id-cell'

0 commit comments

Comments
 (0)