Files

105 lines
4.0 KiB
TypeScript

import AxeBuilder from "@axe-core/playwright";
import { expect, test } from "@playwright/experimental-ct-react";
import {
AdminRolesInterimVisualFixture as RolesVisualFixture,
AdminSecurityInterimVisualFixture as VisualFixture,
} from "../../apps/web/app/components/screens/admin/sales/security/admin-security-interim.visual-fixture";
import { AdminPersonalizedDashboardVisualFixture as DashboardVisualFixture } from "../../apps/web/app/components/screens/admin/admin-personalized-dashboard.visual-fixture";
test.describe("VR-P28a admin identity interim UI", () => {
test("admin identity list stays visually stable in light mode", async ({ mount, page }) => {
const component = await mount(
<div data-testid="vr-p28a-admin-security" style={{ width: "1280px", minHeight: "760px" }}>
<VisualFixture />
</div>
);
await page.evaluate(async () => {
await document.fonts.ready;
});
await expect(component.locator('[data-ui-id="ui.admin.sales.security.adminUsersPage"]')).toHaveCount(1);
await expect(component).toHaveScreenshot("vr-p28a-admin-security.png");
});
test("admin identity list meets WCAG 2 A/AA", async ({ mount, page }) => {
const component = await mount(
<div data-testid="vr-p28a-admin-security-a11y" style={{ width: "1280px", minHeight: "760px" }}>
<VisualFixture />
</div>
);
const results = await new AxeBuilder({ page })
.include('[data-ui-id="ui.admin.sales.security.adminUsersPage"]')
.withTags(["wcag2a", "wcag2aa"])
.analyze();
expect(results.violations).toEqual([]);
await expect(component.getByRole("heading", { name: "Plattform-Admins" })).toHaveCount(1);
});
test("role editor groups permissions and summarizes visible areas", async ({ mount, page }) => {
const component = await mount(
<div data-testid="vr-p28a-admin-roles" style={{ width: "1280px", minHeight: "1400px" }}>
<RolesVisualFixture />
</div>
);
await page.evaluate(async () => {
await document.fonts.ready;
});
await expect(component.getByText("Tatsächlich sichtbare Admin-Bereiche")).toHaveCount(1);
await expect(component).toHaveScreenshot("vr-p28a-admin-roles.png", { fullPage: true });
});
test("grouped role editor meets WCAG 2 A/AA", async ({ mount, page }) => {
const component = await mount(
<div data-testid="vr-p28a-admin-roles-a11y" style={{ width: "1280px", minHeight: "1400px" }}>
<RolesVisualFixture />
</div>
);
const results = await new AxeBuilder({ page })
.include('[data-ui-id="ui.admin.sales.security.adminRolesPage"]')
.withTags(["wcag2a", "wcag2aa"])
.analyze();
expect(results.violations).toEqual([]);
await expect(component.getByRole("heading", { name: "Admin-Rollen" })).toHaveCount(1);
});
test("combined-role dashboard stays visually stable", async ({ mount, page }) => {
const component = await mount(
<div data-testid="vr-p28a-admin-dashboard" style={{ width: "1280px", minHeight: "760px", padding: "24px" }}>
<DashboardVisualFixture />
</div>
);
await page.evaluate(async () => {
await document.fonts.ready;
});
await expect(component.getByText("Vertrieb")).toHaveCount(1);
await expect(component.getByText("Engineering")).toHaveCount(1);
await expect(component).toHaveScreenshot("vr-p28a-admin-dashboard.png");
});
test("combined-role dashboard meets WCAG 2 A/AA", async ({ mount, page }) => {
const component = await mount(
<div data-testid="vr-p28a-admin-dashboard-a11y" style={{ width: "1280px", minHeight: "760px", padding: "24px" }}>
<DashboardVisualFixture />
</div>
);
const results = await new AxeBuilder({ page })
.include('[data-ui-id="ui.admin.personalizedDashboard"]')
.withTags(["wcag2a", "wcag2aa"])
.analyze();
expect(results.violations).toEqual([]);
await expect(component.getByRole("heading", { name: "Dein Arbeitsbereich" })).toHaveCount(1);
});
});