test(e2e): update mock specs for splash changes

This commit is contained in:
2026-07-03 17:39:35 +08:00
parent 186b4d934d
commit 36636ad77b
3 changed files with 13 additions and 8 deletions
+10 -4
View File
@@ -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;
@@ -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$/ });
@@ -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();
});