import { expect, test } from "@playwright/test"; import { completeOnboarding, openUserSettings, signup, waitForChatComposer } from "./helpers"; const ALLOWED_CONSOLE = [/Failed to load resource.*404/i, /favicon/i, /ERR_ABORTED/i]; function attachConsoleGuard(page: import("@playwright/test").Page) { const errors: string[] = []; page.on("console", (msg) => { if (msg.type() !== "error") return; const text = msg.text(); if (ALLOWED_CONSOLE.some((pattern) => pattern.test(text))) return; errors.push(text); }); page.on("pageerror", (err) => errors.push(err.message)); return errors; } test.describe("desktop journeys", () => { test.use({ viewport: { width: 1440, height: 900 } }); test("sign-up through settings has no unexpected console errors", async ({ page }) => { const errors = attachConsoleGuard(page); const stamp = Date.now(); await signup(page, `console-j-${stamp}@rakazo.test`, "password12", "Console QA"); await completeOnboarding(page); await waitForChatComposer(page); await page.goto("/app/heute"); await expect(page).toHaveURL(/\/app\/heute/); await openUserSettings(page); expect(errors, errors.join("\n")).toEqual([]); }); }); test.describe("mobile journeys", () => { test.use({ viewport: { width: 390, height: 844 }, isMobile: true, hasTouch: true, }); test("onboarding and chat shell stay console-clean", async ({ page }) => { const errors = attachConsoleGuard(page); const stamp = Date.now(); await signup(page, `console-m-${stamp}@rakazo.test`, "password12", "Mobile Console"); await completeOnboarding(page); await waitForChatComposer(page); expect(errors, errors.join("\n")).toEqual([]); }); });