import { expect, test } from "@playwright/test"; import { expectNoCriticalA11yViolations } from "./utils/axe"; import { expectNoHorizontalOverflow, narrowMobileViewport } from "./utils/mobile"; const mobileA11yRoutes = ["/", "/login", "/register", "/forgot-password", "/reset", "/auth/magic-link", "/__nonexistent_route__"] as const; test.describe("public and auth mobile a11y", () => { test.use({ viewport: narrowMobileViewport, isMobile: true, hasTouch: true }); for (const route of mobileA11yRoutes) { test(`${route} has no mobile overflow or critical a11y violations`, async ({ page }) => { await page.goto(route, { waitUntil: "domcontentloaded" }); if (route === "/register" && /\/login(?:[?#].*)?$/u.test(page.url())) { await expect(page.locator('input[type="email"], input[name="email"], input#email').first()).toBeVisible(); } else { await expect(page.locator("body")).toBeVisible(); } await expectNoHorizontalOverflow(page); await expectNoCriticalA11yViolations(page); }); } });