Skip to content

Commit 0fee3e3

Browse files
FIX AJ/EO/DB Update elid copy
- a new version is rolling out which changes the eligibility text - using regex allows both versions to be rolled out without breaking the e2e tests
1 parent 57d2828 commit 0fee3e3

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

e2e/elid-copy-helper.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,29 @@ export type UserCopy = Record<string, PageCopy>;
44
export const elidCopyThatDiffersByEnvironment: Record<string, UserCopy> = {
55
["sandpit"]: {
66
user15: {
7-
bulletPoint2: "did not turn 80 between 2nd September 2024 and 31st August 2025",
7+
bulletPoint2v1: "did not turn 80 between 2nd September 2024 and 31st August 2025",
8+
bulletPoint2v2: "did not turn 80 between 2nd September 2024 and 31st August 2025",
89
infoTextHeading: "If you think you need this vaccine",
910
infoTextParagraph: "Speak to your healthcare professional if you think you should be offered this vaccination.",
1011
},
1112
user01: {
12-
bulletPoint1: "are aged 75 to 79",
13+
bulletPoint1v1: "are aged 75 to 79",
14+
bulletPoint1v2: "are aged 75 to 79",
1315
},
1416
user13: {
1517
cardParagraphText: "We believe you had the RSV vaccination on 3 April 2025.",
1618
},
1719
},
1820
["integration"]: {
1921
user15: {
20-
bulletPoint2: "did not turn 80 after 1 September 2024",
22+
bulletPoint2v1: "did not turn 80 after 1 September 2024",
23+
bulletPoint2v2: "do not live in a care home for older adults",
2124
infoTextHeading: "If you think this is incorrect",
2225
infoTextParagraph: "Speak to your healthcare professional if you think you should be offered this vaccine.",
2326
},
2427
user01: {
25-
bulletPoint1: "are aged between 75 and 79",
28+
bulletPoint1v1: "are aged between 75 and 79",
29+
bulletPoint1v2: "are aged 75 or over",
2630
},
2731
user13: {
2832
cardParagraphText: "We believe you were vaccinated against RSV on 3 April 2025.",

e2e/general/eligibility.spec.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,13 @@ test.describe("Eligibility", () => {
2929
level: 2,
3030
name: "We do not believe you can have it",
3131
});
32-
const bulletPoint1: Locator = eligibility.getByText("are not aged 75 to 79", { exact: true }).first();
33-
const bulletPoint2: Locator = eligibility
34-
.getByText(elidCopyForEnvironment.user15.bulletPoint2, { exact: true })
35-
.first();
32+
33+
const bulletPoint1RegEx = new RegExp(`(are not aged 75 to 79|are not aged 75 or over)`);
34+
const bulletPoint2RegEx = new RegExp(
35+
`(${elidCopyForEnvironment.user15.bulletPoint2v1}|${elidCopyForEnvironment.user15.bulletPoint2v2})`,
36+
);
37+
const bulletPoint1: Locator = eligibility.getByText(bulletPoint1RegEx, { exact: true }).first();
38+
const bulletPoint2: Locator = eligibility.getByText(bulletPoint2RegEx, { exact: true }).first();
3639

3740
await expect(heading).toBeVisible();
3841
await expect(bulletPoint1).toBeVisible();
@@ -74,9 +77,11 @@ test.describe("Eligibility", () => {
7477

7578
const eligibility: Locator = page.getByTestId("Eligibility");
7679
const heading: Locator = eligibility.getByRole("heading", { level: 2, name: "You should have the RSV vaccine" });
77-
const bulletPoint: Locator = eligibility
78-
.getByText(elidCopyForEnvironment.user01.bulletPoint1, { exact: true })
79-
.first();
80+
81+
const bulletPoint1RegEx = new RegExp(
82+
`(${elidCopyForEnvironment.user01.bulletPoint1v1}|${elidCopyForEnvironment.user01.bulletPoint1v2})`,
83+
);
84+
const bulletPoint: Locator = eligibility.getByText(bulletPoint1RegEx, { exact: true }).first();
8085

8186
await expect(heading).toBeVisible();
8287
await expect(bulletPoint).toBeVisible();

0 commit comments

Comments
 (0)