import { expect, test } from "./utils/test"; import { expectNoCriticalA11yViolations } from "./utils/axe"; import { getTenantCredentials, loginAsTenantUser } from "./utils/auth"; import { compactMobileViewport, expectNoHorizontalOverflow, narrowMobileViewport } from "./utils/mobile"; import { escapeRegExp, skipIfUnavailable } from "./utils/navigation"; import { skipOrFailWhenE2eInputsMissing } from "./utils/readiness"; const credentials = getTenantCredentials(); const workflowEnginePath = process.env.E2E_WORKFLOW_ENGINE_PATH; test.describe("workflow engine mobile a11y", () => { test.use({ viewport: narrowMobileViewport, isMobile: true, hasTouch: true }); test("overview page has no mobile overflow or critical a11y violations", async ({ page }) => { skipOrFailWhenE2eInputsMissing( ["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD", "E2E_WORKFLOW_ENGINE_PATH"], "Workflow engine mobile a11y inputs not configured" ); await loginAsTenantUser(page, credentials!); const response = await page.goto(workflowEnginePath!, { waitUntil: "domcontentloaded" }); await skipIfUnavailable(page, response, "Workflow engine path"); await expect(page).toHaveURL(new RegExp(`${escapeRegExp(workflowEnginePath!)}(?:[?#].*)?$`, "u")); await expect(page.locator("body")).toBeVisible(); await expectNoHorizontalOverflow(page); await expectNoCriticalA11yViolations(page); }); }); test.describe("workflow engine compact mobile a11y", () => { test.use({ viewport: compactMobileViewport, isMobile: true, hasTouch: true }); test("overview page remains usable at 320px", async ({ page }) => { skipOrFailWhenE2eInputsMissing( ["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD", "E2E_WORKFLOW_ENGINE_PATH"], "Workflow engine compact mobile a11y inputs not configured" ); await loginAsTenantUser(page, credentials!); const response = await page.goto(workflowEnginePath!, { waitUntil: "domcontentloaded" }); await skipIfUnavailable(page, response, "Workflow engine compact path"); await expect(page).toHaveURL(new RegExp(`${escapeRegExp(workflowEnginePath!)}(?:[?#].*)?$`, "u")); await expect(page.locator("body")).toBeVisible(); await expect(page.getByRole("heading").first()).toBeVisible(); await expectNoHorizontalOverflow(page); await expectNoCriticalA11yViolations(page); }); });