test(e2e): update specs for multi-character routes

This commit is contained in:
2026-07-17 16:49:20 +08:00
parent 8a53a07e0e
commit 78e97c3612
10 changed files with 60 additions and 28 deletions
@@ -3,6 +3,7 @@ import { expect, test } from "@playwright/test";
import { mockCoreApis } from "@e2e/fixtures/api-mocks";
import {
clearBrowserState,
defaultCharacterChatUrl,
enterChatFromSplash,
submitEmailLogin,
switchToEmailSignIn,
@@ -24,7 +25,9 @@ test("user can email login from other sign-in options and return to chat", async
await expect(page).toHaveURL(/\/auth(?:\?.*)?$/);
await switchToEmailSignIn(page);
const loginRequest = await submitEmailLogin(page, { expectedUrl: /\/chat$/ });
const loginRequest = await submitEmailLogin(page, {
expectedUrl: defaultCharacterChatUrl,
});
expect(["desktop", "android"]).toContain(loginRequest?.postDataJSON().platform);
await expect(page.getByRole("textbox", { name: "Message" })).toBeVisible();
@@ -3,6 +3,8 @@ import { expect, test } from "@playwright/test";
import { mockCoreApis } from "@e2e/fixtures/api-mocks";
import {
clearBrowserState,
defaultCharacterSidebarPath,
defaultCharacterSplashPath,
getSplashStartChatButton,
signInWithEmailAndOpenChat,
} from "@e2e/fixtures/test-helpers";
@@ -19,7 +21,7 @@ test("user can log out from the sidebar after email login", async ({
await expect(page.getByRole("button", { name: "Menu" })).toBeVisible();
await page.getByRole("button", { name: "Menu" }).click();
await expect(page).toHaveURL(/\/sidebar$/);
await expect(page).toHaveURL(new RegExp(`${defaultCharacterSidebarPath}$`));
const logoutRequestPromise = page.waitForRequest("**/api/auth/logout");
await page.getByRole("button", { name: /Log out/i }).click();
@@ -27,6 +29,6 @@ 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).toHaveURL(new RegExp(`${defaultCharacterSplashPath}$`));
await expect(getSplashStartChatButton(page)).toBeVisible();
});
@@ -1,7 +1,10 @@
import { expect, test } from "@playwright/test";
import { mockCoreApis } from "@e2e/fixtures/api-mocks";
import { clearBrowserState } from "@e2e/fixtures/test-helpers";
import {
clearBrowserState,
defaultCharacterChatUrl,
} from "@e2e/fixtures/test-helpers";
const psid = "e2e-facebook-psid";
@@ -27,7 +30,7 @@ test("user enters from an external PSID link and becomes a guest", async ({
});
expect(psidLoginRequest.postDataJSON().deviceId).toEqual(expect.any(String));
await expect(page).toHaveURL(/\/chat$/);
await expect(page).toHaveURL(defaultCharacterChatUrl);
await expect(page.getByRole("textbox", { name: "Message" })).toBeVisible();
await expect