Skip to content

Commit db00efb

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

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

e2e/auth.ts

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,33 @@ export const login = async (browser: Browser, nhsLoginUsername: string): Promise
7777
await page.waitForURL(user.vaccinationsHubUrl, { timeout: 60000, waitUntil: "domcontentloaded" });
7878
return page;
7979
} else {
80+
await page.waitForURL(/\/(terms-and-conditions\?redirect_to=index|passkey\/setup-passkey|patient\/whats-new)$/, {
81+
timeout: 30000,
82+
});
83+
if (new URL(page.url()).pathname === "/passkey/setup-passkey") {
84+
await page.getByRole("link", { name: "Skip passkey setup and continue to NHS App" }).click();
85+
}
86+
87+
await page.waitForURL(/\/(terms-and-conditions\?redirect_to=index|patient\/|patient\/whats-new)$/, {
88+
timeout: 30000,
89+
});
90+
if (new URL(page.url()).pathname === "/patient/whats-new") {
91+
await page.getByRole("button", { name: "Continue" }).click();
92+
}
93+
8094
await page.waitForURL(/\/(terms-and-conditions\?redirect_to=index|patient\/)$/, { timeout: 30000 });
8195
if (new URL(page.url()).pathname === "/terms-and-conditions") {
8296
await page.locator("#termsAndConditions-agree_checkbox").setChecked(true);
8397
await page.getByRole("button", { name: "Continue" }).click();
8498
}
8599

86100
await page.waitForURL("**/patient/", { timeout: 30000 });
87-
await page.getByRole("heading", { name: "Services" }).locator("..").getByRole("link", { name: "View all" }).click();
88-
await page.waitForURL("**/patient/services", { timeout: 30000 });
101+
await page.locator('li[data-qa="vaccination-panel-link"]').getByRole("link", { name: "Vaccinations" }).click();
102+
await page.waitForURL("**/patient/vaccinations", { timeout: 30000 });
89103

90104
const newTabPromise = page.context().waitForEvent("page");
91-
await page.getByRole("link", { name: "Check and book an RSV vaccination" }).click();
105+
await page.getByRole("link", { name: "Check and book vaccinations" }).click();
106+
92107
const newTabPage = await newTabPromise;
93108

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

0 commit comments

Comments
 (0)