Skip to content

Commit 3795087

Browse files
[TASK] Update EliD E2E tests to match requested content changes
1 parent 57b4558 commit 3795087

File tree

2 files changed

+27
-17
lines changed

2 files changed

+27
-17
lines changed

e2e/elid-copy-helper.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ export const elidCopyThatDiffersByEnvironment: Record<string, UserCopy> = {
88
infoTextHeading: "If you think you need this vaccine",
99
infoTextParagraph: "Speak to your healthcare professional if you think you should be offered this vaccination.",
1010
},
11-
user05: {
12-
cardParagraphText: "To change or cancel your appointment, contact the provider you booked with.",
13-
},
1411
user01: {
1512
bulletPoint1: "are aged 75 to 79",
1613
},
@@ -21,12 +18,9 @@ export const elidCopyThatDiffersByEnvironment: Record<string, UserCopy> = {
2118
["integration"]: {
2219
user15: {
2320
bulletPoint2: "did not turn 80 after 1 September 2024",
24-
infoTextHeading: "If you think this is incorrect",
21+
infoTextHeading: "If this applies to you",
2522
infoTextParagraph: "Speak to your healthcare professional if you think you should be offered this vaccine.",
2623
},
27-
user05: {
28-
cardParagraphText: "To change or cancel your appointment, contact the provider you booked it with.",
29-
},
3024
user01: {
3125
bulletPoint1: "are aged between 75 and 79",
3226
},

e2e/general/eligibility.spec.ts

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,21 @@ test.describe("Eligibility", () => {
4141
test("Not Eligible - InfoText action content", async ({ page }) => {
4242
await page.goto(RSV_PAGE_URL);
4343

44-
const infoTextHeading = page.getByRole("heading", {
45-
level: 2,
46-
name: elidCopyForEnvironment.user15.infoTextHeading,
47-
});
48-
const infoTextParagraph = page
49-
.locator(`h2:has-text("${elidCopyForEnvironment.user15.infoTextHeading}") + p`)
50-
.first();
44+
let infoTextHeading, infoTextParagraph;
45+
46+
if (environment === "preprod") {
47+
infoTextHeading = page.getByRole("heading", {
48+
level: 3,
49+
name: elidCopyForEnvironment.user15.infoTextHeading,
50+
});
51+
infoTextParagraph = page.locator(`h3:has-text("${elidCopyForEnvironment.user15.infoTextHeading}") + p`).first();
52+
} else {
53+
infoTextHeading = page.getByRole("heading", {
54+
level: 2,
55+
name: elidCopyForEnvironment.user15.infoTextHeading,
56+
});
57+
infoTextParagraph = page.locator(`h2:has-text("${elidCopyForEnvironment.user15.infoTextHeading}") + p`).first();
58+
}
5159
const tagName = await infoTextParagraph.evaluate((element) => element.tagName);
5260

5361
await expect(infoTextHeading).toBeVisible();
@@ -76,8 +84,14 @@ test.describe("Eligibility", () => {
7684
test("Actionable - InfoText action content", async ({ page }) => {
7785
await page.goto(RSV_PAGE_URL);
7886

79-
const infoTextHeading = page.getByRole("heading", { level: 2, name: "Getting the vaccine" });
80-
const infoTextParagraph = page.locator('h2:has-text("Getting the vaccine") + p').first();
87+
let infoTextHeading, infoTextParagraph;
88+
if (environment === "preprod") {
89+
infoTextHeading = page.getByRole("heading", { level: 3, name: "Getting the vaccine" });
90+
infoTextParagraph = page.locator('h3:has-text("Getting the vaccine") + p').first();
91+
} else {
92+
infoTextHeading = page.getByRole("heading", { level: 2, name: "Getting the vaccine" });
93+
infoTextParagraph = page.locator('h2:has-text("Getting the vaccine") + p').first();
94+
}
8195
const tagName = await infoTextParagraph.evaluate((element) => element.tagName);
8296

8397
await expect(infoTextHeading).toBeVisible();
@@ -114,7 +128,9 @@ test.describe("Eligibility", () => {
114128
await expect(cardHeading).toBeVisible();
115129
await expect(cardHeading).toHaveClass("nhsuk-heading-m nhsuk-card__heading");
116130
await expect(cardParagraph).toBeVisible();
117-
await expect(cardParagraph).toHaveText(elidCopyForEnvironment.user05.cardParagraphText);
131+
await expect(cardParagraph).toHaveText(
132+
"To change or cancel your appointment, contact the provider you booked with.",
133+
);
118134
await expect(cardParagraph).toHaveClass("nhsuk-card__description");
119135
});
120136
});

0 commit comments

Comments
 (0)