From 36636ad77b0372a1d7924fce9c8ea60240dc40ff Mon Sep 17 00:00:00 2001 From: chenhang Date: Fri, 3 Jul 2026 17:39:35 +0800 Subject: [PATCH] test(e2e): update mock specs for splash changes --- e2e/fixtures/test-helpers.ts | 14 ++++++++++---- .../auth/email-login-from-other-options.spec.ts | 2 +- e2e/specs/mock/auth/logout-from-sidebar.spec.ts | 5 ++--- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/e2e/fixtures/test-helpers.ts b/e2e/fixtures/test-helpers.ts index d588c76d..46b79bc4 100644 --- a/e2e/fixtures/test-helpers.ts +++ b/e2e/fixtures/test-helpers.ts @@ -5,6 +5,12 @@ export const e2eEmailCredentials = { password: "12345678", }; +export const splashStartChatButtonName = "Start Chatting"; + +export function getSplashStartChatButton(page: Page) { + return page.getByRole("button", { name: splashStartChatButtonName }); +} + export async function clearBrowserState( context: BrowserContext, page: Page, @@ -45,12 +51,12 @@ export async function enterChatFromSplash( await page.goto("/splash", { waitUntil }); - const skipButton = page.getByRole("button", { name: "Skip" }); - await expect(skipButton).toBeVisible({ timeout }); - await expect(skipButton).toBeEnabled(); + const startChatButton = getSplashStartChatButton(page); + await expect(startChatButton).toBeVisible({ timeout }); + await expect(startChatButton).toBeEnabled(); for (let attempt = 0; attempt < 3; attempt += 1) { - await skipButton.click(); + await startChatButton.click(); try { await expect(page).toHaveURL(expectedUrl, { timeout: 3_000 }); return; diff --git a/e2e/specs/mock/auth/email-login-from-other-options.spec.ts b/e2e/specs/mock/auth/email-login-from-other-options.spec.ts index 757cf229..6ed4e657 100644 --- a/e2e/specs/mock/auth/email-login-from-other-options.spec.ts +++ b/e2e/specs/mock/auth/email-login-from-other-options.spec.ts @@ -21,7 +21,7 @@ test("user can email login from other sign-in options and return to chat", async await page .getByRole("button", { name: "Sign up to unlock more features" }) .click(); - await expect(page).toHaveURL(/\/auth$/); + await expect(page).toHaveURL(/\/auth(?:\?.*)?$/); await switchToEmailSignIn(page); const loginRequest = await submitEmailLogin(page, { expectedUrl: /\/chat$/ }); diff --git a/e2e/specs/mock/auth/logout-from-sidebar.spec.ts b/e2e/specs/mock/auth/logout-from-sidebar.spec.ts index 0d213034..ab81f019 100644 --- a/e2e/specs/mock/auth/logout-from-sidebar.spec.ts +++ b/e2e/specs/mock/auth/logout-from-sidebar.spec.ts @@ -26,9 +26,8 @@ test("user can log out from the sidebar after email login", async ({ const logoutRequest = await logoutRequestPromise; expect(logoutRequest.method()).toBe("POST"); - await expect(page).toHaveURL(/\/splash$/); - await expect(page.getByRole("button", { name: "Skip" })).toBeVisible(); + await expect(page).toHaveURL(/\/chat$/); await expect( - page.getByRole("button", { name: "Login with Facebook" }), + page.getByRole("button", { name: "Sign up to unlock more features" }), ).toBeVisible(); });