Reorganize repo structure and standards references
This commit is contained in:
1 parent
3cb93a81be
commit
be2054274d
5885 files changed
+2588
-195
No files matched your search
+49
@@ -0,0 +1,49 @@
|
||||
import { expect, test } from "./utils/test";
|
||||
import { expectNoCriticalA11yViolations } from "./utils/axe";
|
||||
import { getTenantCredentials, loginAsTenantUser } from "./utils/auth";
|
||||
import { expectNoHorizontalOverflow, narrowMobileViewport } from "./utils/mobile";
|
||||
import { skipOrFailWhenE2eFixtureMissing, skipOrFailWhenE2eInputsMissing } from "./utils/readiness";
|
||||
|
||||
const credentials = getTenantCredentials();
|
||||
const portalManagementPaths = [
|
||||
{ name: "analytics", path: process.env.E2E_TENANT_PORTAL_ANALYTICS_PATH },
|
||||
{ name: "settings", path: process.env.E2E_TENANT_PORTAL_SETTINGS_PATH },
|
||||
].filter((target): target is { name: string; path: string } => Boolean(target.path));
|
||||
|
||||
test.describe("portal management mobile a11y", () => {
|
||||
test.use({ viewport: narrowMobileViewport, isMobile: true, hasTouch: true });
|
||||
|
||||
test("portal management pages have no mobile overflow or critical a11y violations", async ({ page }) => {
|
||||
if (!credentials) {
|
||||
skipOrFailWhenE2eInputsMissing(["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD"], "Skipping portal mobile a11y");
|
||||
}
|
||||
if (portalManagementPaths.length === 0) {
|
||||
skipOrFailWhenE2eFixtureMissing("E2E_TENANT_PORTAL_ANALYTICS_PATH or E2E_TENANT_PORTAL_SETTINGS_PATH is required for portal mobile a11y");
|
||||
}
|
||||
|
||||
await loginAsTenantUser(page, credentials!);
|
||||
|
||||
for (const target of portalManagementPaths) {
|
||||
await page.goto(target.path, { waitUntil: "domcontentloaded" });
|
||||
// The portals plugin module is gated out of the route config by default
|
||||
// (app.$tenant/__portals/** in defaultDisabledPluginRouteFilePatterns), so
|
||||
// the path redirects home when it isn't mounted. Treat that as an
|
||||
// unavailable optional feature here; the readiness lane
|
||||
// (REQUIRE_E2E_READINESS=1) still fails loudly so a deployment that ships
|
||||
// portals is verified there.
|
||||
const landedOnPortal = new RegExp(`${escapeRegExp(target.path)}(?:[?#].*)?$`, "u").test(page.url());
|
||||
if (!landedOnPortal) {
|
||||
skipOrFailWhenE2eFixtureMissing(`Portal route ${target.path} is not mounted (portals module disabled)`);
|
||||
}
|
||||
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(target.path)}(?:[?#].*)?$`, "u"));
|
||||
await expect(page.locator("body")).toBeVisible();
|
||||
|
||||
await expectNoHorizontalOverflow(page);
|
||||
await expectNoCriticalA11yViolations(page);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function escapeRegExp(value: string): string {
|
||||
return value.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&");
|
||||
}
|
||||
Reference in new issue
Block a user