Skip to content

Commit 145ff81

Browse files
FIX TS/AS Update E2E tests to handle NHS App whats-new page
1 parent f418d52 commit 145ff81

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

e2e/auth.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,25 +86,34 @@ export const login = async (browser: Browser, nhsLoginUsername: string): Promise
8686
await page.waitForURL(user.vaccinationsHubUrl, { timeout: 60000, waitUntil: "domcontentloaded" });
8787
return page;
8888
} else {
89-
await page.waitForURL(/\/(terms-and-conditions\?redirect_to=index|passkey\/setup-passkey|patient\/)$/, {
89+
await page.waitForURL(/\/(terms-and-conditions\?redirect_to=index|passkey\/setup-passkey|patient\/whats-new)$/, {
9090
timeout: 30000,
9191
});
9292
if (new URL(page.url()).pathname === "/passkey/setup-passkey") {
9393
await page.getByRole("link", { name: "Skip passkey setup and continue to NHS App" }).click();
9494
}
9595

96+
await page.waitForURL(/\/(terms-and-conditions\?redirect_to=index|patient\/|patient\/whats-new)$/, {
97+
timeout: 30000,
98+
});
99+
if (new URL(page.url()).pathname === "/patient/whats-new") {
100+
await page.getByRole("button", { name: "Continue" }).click();
101+
}
102+
96103
await page.waitForURL(/\/(terms-and-conditions\?redirect_to=index|patient\/)$/, { timeout: 30000 });
97104
if (new URL(page.url()).pathname === "/terms-and-conditions") {
98105
await page.locator("#termsAndConditions-agree_checkbox").setChecked(true);
99106
await page.getByRole("button", { name: "Continue" }).click();
100107
}
101108

102109
await page.waitForURL("**/patient/", { timeout: 30000 });
103-
await page.getByRole("heading", { name: "Services" }).locator("..").getByRole("link", { name: "View all" }).click();
104-
await page.waitForURL("**/patient/services", { timeout: 30000 });
110+
await page.locator('li[data-qa="vaccination-panel-link"]').getByRole("link", { name: "Vaccinations" }).click();
111+
await page.waitForURL("**/patient/vaccinations", { timeout: 30000 });
105112

106113
const newTabPromise = page.context().waitForEvent("page");
107-
await page.getByRole("link", { name: "Check and book an RSV vaccination" }).click();
114+
115+
await page.getByRole("link", { name: "Check and book vaccinations" }).click();
116+
108117
const newTabPage = await newTabPromise;
109118

110119
await newTabPage.waitForURL(user.vaccinationsHubUrl, { timeout: 60000, waitUntil: "networkidle" });

0 commit comments

Comments
 (0)