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
@@ -4,6 +4,7 @@ import { mockCoreApis } from "@e2e/fixtures/api-mocks";
import {
clearBrowserState,
completeVipPayment,
defaultCharacterChatUrl,
dismissChatInterruptions,
enterChatFromSplash,
expectAuthRedirectToVipChatSubscription,
@@ -29,9 +30,9 @@ test("guest uses the shared chat limit top-up flow", async ({ page }) => {
await dismissChatInterruptions(page);
const messageInput = page.getByRole("textbox", { name: "Message" });
const quantityLimitBanner = page
.getByRole("status")
.filter({ hasText: "Insufficient credits" });
const quantityLimitBanner = page.getByTestId(
"chat-insufficient-credits-banner",
);
let limitTriggeredAt: number | null = null;
let completedSendCount = 0;
@@ -79,9 +80,7 @@ test("guest uses the shared chat limit top-up flow", async ({ page }) => {
expect(limitTriggeredAt).toBe(mockedLimitTriggerAt);
await expect(quantityLimitBanner).toBeVisible();
await expect(
quantityLimitBanner.getByText("Free chats refresh every day."),
).toBeVisible();
await expect(quantityLimitBanner.getByText("Out of Daily Free Chats")).toBeVisible();
const topUpButton = quantityLimitBanner.getByRole("button", {
name: "Top up credits to continue",
});
@@ -97,7 +96,7 @@ test("guest uses the shared chat limit top-up flow", async ({ page }) => {
await completeVipPayment(page);
await expect(page).toHaveURL(/\/chat$/);
await expect(page).toHaveURL(defaultCharacterChatUrl);
await expect(page.getByRole("textbox", { name: "Message" })).toBeVisible();
});
@@ -4,6 +4,7 @@ import { mockCoreApis } from "@e2e/fixtures/api-mocks";
import {
clearBrowserState,
completeVipPayment,
defaultCharacterChatUrl,
expectInsufficientCreditsDialog,
expectVipChatSubscriptionUrl,
setEmailSessionStorage,
@@ -24,7 +25,7 @@ test("guest unlocks a promoted image through email login and top-up", async ({
await page.goto(
"/external-entry?target=chat&mode=promotion&promotion_type=image",
);
await expect(page).toHaveURL(/\/chat$/);
await expect(page).toHaveURL(defaultCharacterChatUrl);
const unlockButton = page.getByRole("button", {
name: "Unlock private image",
@@ -35,7 +36,7 @@ test("guest unlocks a promoted image through email login and top-up", async ({
await expect(page).toHaveURL(/\/auth\?redirect=/);
await switchToEmailSignIn(page);
await submitEmailLogin(page, { expectedUrl: /\/chat$/ });
await submitEmailLogin(page, { expectedUrl: defaultCharacterChatUrl });
await setEmailSessionStorage(page);
const unlockRequestPromise = page.waitForRequest(
@@ -57,6 +58,6 @@ test("guest unlocks a promoted image through email login and top-up", async ({
await expectVipChatSubscriptionUrl(page);
await completeVipPayment(page);
await expect(page).toHaveURL(/\/chat$/);
await expect(page).toHaveURL(defaultCharacterChatUrl);
await expect(page.getByRole("textbox", { name: "Message" })).toBeVisible();
});