/** * Smoke test: verify the app loads without React errors. * * This test ensures that the Vite build resolves a single React * instance (no duplicate React versions from pnpm transitive deps). */ import { test, expect } from "@playwright/test"; test("app loads without React hook errors", async ({ page }) => { const consoleErrors: string[] = []; const pageErrors: string[] = []; page.on("console", (msg) => { if (msg.type() === "error") consoleErrors.push(msg.text()); }); page.on("pageerror", (err) => { pageErrors.push(err.message); }); await page.goto("/app", { waitUntil: "domcontentloaded", timeout: 10000 }); await page.waitForTimeout(5000); // The critical check: no "Invalid hook call" or related React errors const hookErrors = pageErrors.filter((e) => e.includes("Invalid hook call") || e.includes("useMemo") || e.includes("useRef") || e.includes("useContext") || e.includes("more than one copy of React") ); expect(hookErrors).toEqual([]); // Root element must exist await expect(page.locator("#root")).toBeAttached(); // Should show either login form or app content (not a blank/dark screen) const bodyText = await page.evaluate(() => document.body?.innerText || ""); const hasContent = bodyText.includes("Sign in") || bodyText.includes("Anmelden") || bodyText.includes("EvOo") || bodyText.includes("Projekte") || bodyText.includes("Heute") || bodyText.includes("Team"); expect(hasContent).toBe(true); });