Files
cozsweet-frontend-nextjs/e2e/specs/mock/splash-chat.spec.ts
T

40 lines
1.3 KiB
TypeScript

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();
});