feat(e2e): add email login flow tests and mock responses for email user

This commit is contained in:
2026-06-29 17:43:27 +08:00
parent 187bf3469e
commit e951d56076
5 changed files with 86 additions and 96 deletions
+15
View File
@@ -3,9 +3,12 @@ import type { Page } from "@playwright/test";
import {
apiEnvelope,
chatSendResponse,
e2eEmailUser,
emptyChatHistoryResponse,
emailLoginResponse,
guestLoginResponse,
paymentPlansResponse,
userEntitlementsResponse,
vipStatusResponse,
} from "./test-data";
@@ -14,6 +17,18 @@ export async function mockCoreApis(page: Page): Promise<void> {
await route.fulfill({ json: apiEnvelope(guestLoginResponse) });
});
await page.route("**/api/auth/login", async (route) => {
await route.fulfill({ json: apiEnvelope(emailLoginResponse) });
});
await page.route("**/api/user/profile", async (route) => {
await route.fulfill({ json: apiEnvelope(e2eEmailUser) });
});
await page.route("**/api/user/entitlements", async (route) => {
await route.fulfill({ json: apiEnvelope(userEntitlementsResponse) });
});
await page.route("**/api/chat/history**", async (route) => {
await route.fulfill({ json: apiEnvelope(emptyChatHistoryResponse) });
});