56 lines
3.2 KiB
TypeScript
56 lines
3.2 KiB
TypeScript
import { expect, test } from "./utils/test";
|
|
import { expectNoCriticalA11yViolations } from "./utils/axe";
|
|
import { getTenantCredentials, loginAsTenantUser, tenantSettingsAuditExportPath } from "./utils/auth";
|
|
import { compactMobileViewport, expectNoHorizontalOverflow, narrowMobileViewport } from "./utils/mobile";
|
|
import { escapeRegExp, skipIfUnavailable } from "./utils/navigation";
|
|
import { skipOrFailWhenE2eFixtureMissing, skipOrFailWhenE2eInputsMissing } from "./utils/readiness";
|
|
|
|
const credentials = getTenantCredentials();
|
|
const dashboardPath = process.env.E2E_TENANT_DASHBOARD_PATH;
|
|
const auditExportPath = process.env.E2E_TENANT_AUDIT_EXPORT_PATH ?? (dashboardPath ? tenantSettingsAuditExportPath(dashboardPath) : undefined);
|
|
|
|
test.describe("tenant audit export mobile a11y", () => {
|
|
test.use({ isMobile: true, hasTouch: true });
|
|
|
|
test.beforeEach(() => {
|
|
skipOrFailWhenE2eInputsMissing(
|
|
["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD", "E2E_TENANT_DASHBOARD_PATH"],
|
|
"Tenant audit export E2E inputs not configured"
|
|
);
|
|
if (!auditExportPath) {
|
|
skipOrFailWhenE2eFixtureMissing("Tenant audit export path could not be derived; set E2E_TENANT_AUDIT_EXPORT_PATH");
|
|
}
|
|
});
|
|
|
|
for (const viewport of [narrowMobileViewport, compactMobileViewport]) {
|
|
test(`keeps compliance export filters usable at ${viewport.width}px`, async ({ page }) => {
|
|
await page.setViewportSize(viewport);
|
|
await loginAsTenantUser(page, credentials!);
|
|
|
|
const response = await page.goto(auditExportPath!, { waitUntil: "domcontentloaded" });
|
|
await skipIfUnavailable(page, response, `Tenant audit export path ${auditExportPath}`);
|
|
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(auditExportPath!)}(?:[?#].*)?$`, "u"));
|
|
|
|
const form = page.locator('[data-ui-id="ui.settings.auditExport.form"]').first();
|
|
await expect(page.locator('[data-ui-id="ui.settings.auditExport.page"]').first()).toBeVisible();
|
|
await expect(form).toBeVisible();
|
|
await expect(form.locator('[data-ui-id="ui.settings.auditExport.from"]')).toBeVisible();
|
|
await expect(form.locator('[data-ui-id="ui.settings.auditExport.to"]')).toBeVisible();
|
|
await expect(form.locator('[data-ui-id="ui.settings.auditExport.regulatoryScope"]')).toBeVisible();
|
|
await expect(form.locator('[data-ui-id="ui.settings.auditExport.actorType"]')).toBeVisible();
|
|
await expect(form.locator('[data-ui-id="ui.settings.auditExport.outcome"]')).toBeVisible();
|
|
await expect(form.locator('[data-ui-id="ui.settings.auditExport.downloadCsv"]')).toBeVisible();
|
|
await expect(form.locator('[data-ui-id="ui.settings.auditExport.downloadPdf"]')).toBeVisible();
|
|
|
|
await form.locator('[data-ui-id="ui.settings.auditExport.from"]').fill("2026-01-01");
|
|
await form.locator('[data-ui-id="ui.settings.auditExport.to"]').fill("2026-01-31");
|
|
await form.locator('[data-ui-id="ui.settings.auditExport.regulatoryScope"]').selectOption("soc2");
|
|
await form.locator('[data-ui-id="ui.settings.auditExport.actorType"]').selectOption("user");
|
|
await form.locator('[data-ui-id="ui.settings.auditExport.outcome"]').selectOption("success");
|
|
|
|
await expectNoHorizontalOverflow(page);
|
|
await expectNoCriticalA11yViolations(page);
|
|
});
|
|
}
|
|
});
|