import { expect, test } from "./utils/test"; import { expectNoCriticalA11yViolations } from "./utils/axe"; import { getTenantCredentials, loginAsTenantUser } from "./utils/auth"; import { skipOrFailWhenE2eInputsMissing } from "./utils/readiness"; const credentials = getTenantCredentials(); const dashboardPath = process.env.E2E_TENANT_DASHBOARD_PATH ?? "/app/dashboard"; test.describe("tenant dashboard a11y", () => { test("tenant dashboard has no critical or serious axe violations", async ({ page }) => { skipOrFailWhenE2eInputsMissing(["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD"], "Skipping authenticated dashboard scan"); // Use the shared cached-login helper instead of a raw per-test login: a // fresh login on every spec saturates the server auth rate limit during the // serial suite and intermittently leaves the page on /login. await loginAsTenantUser(page, credentials!); await page.goto(dashboardPath, { waitUntil: "domcontentloaded" }); expect(page.url()).toContain(dashboardPath); await expectNoCriticalA11yViolations(page); }); });