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
+39
View File
@@ -0,0 +1,39 @@
import { expect, test } from "@playwright/test";
import { mockCoreApis } from "../../fixtures/api-mocks";
test.beforeEach(async ({ context, page }) => {
await context.clearCookies();
await mockCoreApis(page);
});
test("guest can skip splash, enter chat, and send a message", async ({ page }) => {
await page.goto("/splash");
await page.getByRole("button", { name: "Skip" }).click();
await expect(page).toHaveURL(/\/chat$/);
const messageInput = page.getByRole("textbox", { name: "Message" });
await expect(messageInput).toBeVisible();
await messageInput.fill("hello e2e");
await page.getByRole("button", { name: "Send message" }).click();
await expect(page.getByText("hello e2e")).toBeVisible();
await expect(page.getByText("Hello from the E2E boyfriend.")).toBeVisible();
});
test("subscription page renders mocked plans without touching real payment", async ({
page,
}) => {
await page.goto("/splash");
await page.getByRole("button", { name: "Skip" }).click();
await expect(page).toHaveURL(/\/chat$/);
await page.goto("/subscription?type=vip");
await expect(page.getByText("Subscribe to become the VIP Member")).toBeVisible();
await expect(page.getByText("Monthly")).toBeVisible();
await expect(page.getByText("Quarterly")).toBeVisible();
await expect(page.getByRole("button", { name: /Pay and Activiate/i })).toBeVisible();
});