test(e2e): add playwright smoke coverage

This commit is contained in:
2026-06-25 14:19:38 +08:00
parent 6081f2896a
commit 5879b7acf3
10 changed files with 402 additions and 8 deletions
+32
View File
@@ -0,0 +1,32 @@
import type { Page } from "@playwright/test";
import {
apiEnvelope,
chatSendResponse,
emptyChatHistoryResponse,
guestLoginResponse,
paymentPlansResponse,
vipStatusResponse,
} from "./test-data";
export async function mockCoreApis(page: Page): Promise<void> {
await page.route("**/api/auth/guest", async (route) => {
await route.fulfill({ json: apiEnvelope(guestLoginResponse) });
});
await page.route("**/api/chat/history**", async (route) => {
await route.fulfill({ json: apiEnvelope(emptyChatHistoryResponse) });
});
await page.route("**/api/chat/send", async (route) => {
await route.fulfill({ json: apiEnvelope(chatSendResponse) });
});
await page.route("**/api/payment/plans**", async (route) => {
await route.fulfill({ json: apiEnvelope(paymentPlansResponse) });
});
await page.route("**/api/payment/vip-status**", async (route) => {
await route.fulfill({ json: apiEnvelope(vipStatusResponse) });
});
}