Files
HiveGrid-Wireframes/03 Quellen und Referenzen/hivegrid-cloud/tests/e2e/tenant-roles-permissions.desktop-a11y.spec.ts
2026-07-08 16:15:37 +02:00

62 lines
3.3 KiB
TypeScript

import { expect, test } from "./utils/test";
import { expectNoCriticalA11yViolations } from "./utils/axe";
import { getTenantCredentials, loginAsTenantUser, tenantRolesAndPermissionsPath } from "./utils/auth";
import { expectNoHorizontalOverflow } from "./utils/mobile";
import { escapeRegExp, skipIfUnavailable } from "./utils/navigation";
import { skipOrFailWhenE2eFixtureMissing, skipOrFailWhenE2eInputsMissing } from "./utils/readiness";
// R-P2b (D-P2 Admin RBAC): one merged "Rollen und Berechtigungen" tab (S02).
// The old users/permissions sub-tabs redirect (matrix → members, permissions →
// roles); the S01/S02 tab bar links members and roles.
const credentials = getTenantCredentials();
const dashboardPath = process.env.E2E_TENANT_DASHBOARD_PATH;
const rolesAndPermissionsPath =
process.env.E2E_TENANT_ROLES_AND_PERMISSIONS_PATH ?? (dashboardPath ? tenantRolesAndPermissionsPath(dashboardPath) : undefined);
test.describe("tenant roles and permissions desktop a11y", () => {
test.use({ viewport: { width: 1440, height: 900 } });
test.beforeEach(() => {
skipOrFailWhenE2eInputsMissing(
["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD", "E2E_TENANT_DASHBOARD_PATH"],
"Tenant roles and permissions E2E inputs not configured"
);
if (!rolesAndPermissionsPath) {
skipOrFailWhenE2eFixtureMissing("Tenant roles and permissions path could not be derived; set E2E_TENANT_ROLES_AND_PERMISSIONS_PATH");
}
});
test("renders the merged roles tab without desktop overflow or critical a11y violations", async ({ page }) => {
await loginAsTenantUser(page, credentials!);
const response = await page.goto(rolesAndPermissionsPath!, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, `Tenant roles and permissions path ${rolesAndPermissionsPath}`);
const rolesPath = `${rolesAndPermissionsPath}/roles`;
// Index redirects into the merged S02 roles tab.
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(rolesPath)}(?:[?#].*)?$`, "u"));
await expect(page.locator('[data-ui-id="ui.settings.rolesAndPermissions.page"]').first()).toBeVisible();
await expect(page.locator('[data-ui-id="ui.settings.rolesAndPermissions.roles"] table').first()).toBeVisible();
await expect(page.locator('[data-ui-id="ui.settings.rolesAndPermissions.roles.filter"]').first()).toBeVisible();
// S01/S02 tab bar: link back to the members tab.
await expect(page.locator('[data-ui-id="ui.settings.rolesAndPermissions.tab.members"]').first()).toBeVisible();
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
});
test("redirects the legacy users and permissions sub-tabs", async ({ page }) => {
await loginAsTenantUser(page, credentials!);
const usersResponse = await page.goto(`${rolesAndPermissionsPath!}/users`, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, usersResponse, `Tenant roles users path ${rolesAndPermissionsPath}/users`);
// Matrix is superseded by the inline role dropdown in the members list (D01).
await expect(page).toHaveURL(/\/settings\/members(?:[?#].*)?$/u);
await page.goto(`${rolesAndPermissionsPath!}/permissions`, { waitUntil: "domcontentloaded" });
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(`${rolesAndPermissionsPath}/roles`)}(?:[?#].*)?$`, "u"));
});
});