// E2E Test Helpers import { type Page, test as base } from "@playwright/test"; export interface E2ETestFixture { baseURL: string; } // Extend the base test with custom fixtures export const test = base.extend({ baseURL: async (_unusedParam, use) => { // deno-lint-ignore react-rules-of-hooks await use("http://127.0.0.1:8080"); }, }); export { expect } from "@playwright/test"; // E2E User Headers for API testing export function e2eHeaders(userKey: string): Record { void userKey; return { "Content-Type": "application/json", }; } // Apply E2E mode to a page export async function applyE2EMode(page: Page) { await page.addInitScript(() => { }); } // Navigate to a URL with E2E mode export async function gotoE2E(page: Page, path: string) { await applyE2EMode(page); await page.goto(path); } // Wait for and assert no console errors export async function assertNoConsoleErrors(page: Page) { const errors: string[] = []; page.on("console", (msg) => { if (msg.type() === "error") { errors.push(msg.text()); } }); await page.waitForTimeout(500); // Small delay to catch any errors return errors; }