M24: implement privacy governance

This commit is contained in:
NuklearRabbit
2026-08-10 15:56:03 +02:00
parent f0f1be83ae
commit 0935901f11
29 changed files with 920 additions and 11 deletions
+7 -1
View File
@@ -25,7 +25,7 @@ test.beforeEach(async ({ page, request }) => {
await expect(page).toHaveURL(/\/dashboard$/);
});
test("all seven nav items navigate correctly", async ({ page }) => {
test("all manager navigation items navigate correctly", async ({ page }) => {
const items: [string, RegExp][] = [
["Overview", /\/dashboard$/],
["Fleet", /\/vehicles$/],
@@ -34,6 +34,8 @@ test("all seven nav items navigate correctly", async ({ page }) => {
["Knowledge", /\/knowledge$/],
["Integrations", /\/automation$/],
["Audit trail", /\/audit$/],
["Users", /\/users$/],
["Privacy", /\/privacy$/],
];
const primaryNavigation = page.getByRole("navigation", { name: "Primary navigation" });
for (const [label, urlPattern] of items) {
@@ -378,6 +380,7 @@ test("rental employee role has a restricted nav and cannot reach manager-only pa
await expect(page.getByRole("link", { name: "Data quality" })).toHaveCount(0);
await expect(page.getByRole("link", { name: "Integrations" })).toHaveCount(0);
await expect(page.getByRole("link", { name: "Audit trail" })).toHaveCount(0);
await expect(page.getByRole("link", { name: "Privacy" })).toHaveCount(0);
// Direct URL navigation is still blocked server-side and shows the same restricted
// message as a defense-in-depth measure, not just a hidden button.
@@ -394,6 +397,9 @@ test("rental employee role has a restricted nav and cannot reach manager-only pa
await page.goto("/audit");
await expect(page.getByText("Audit history is visible to Operations Managers only.").first()).toBeVisible();
await page.goto("/privacy");
await expect(page.getByText("These governance functions are available to Operations Managers only.")).toBeVisible();
await expect(page.getByRole("button", { name: "Reset demo data" })).toHaveCount(0);
});
+29
View File
@@ -0,0 +1,29 @@
import { expect, test, type APIRequestContext, type Page } from "@playwright/test";
async function resetAndLogin(request: APIRequestContext, page: Page) {
await request.post("/api/v1/demo/login", { data: { role: "operations_manager" } });
await request.post("/api/v1/demo/reset");
await page.goto("/login");
await page.getByRole("button", { name: "Verken als Operationsmanager" }).click();
}
test("privacy centre reports policy and produces an audited CSV export", async ({ page, request }) => {
await resetAndLogin(request, page);
await page.goto("/privacy");
await expect(page.getByRole("heading", { name: "Privacybeheer" })).toBeVisible();
await expect(page.getByText("30 dagen")).toBeVisible();
const downloadPromise = page.waitForEvent("download");
await page.getByRole("link", { name: "Audit CSV downloaden" }).click();
const download = await downloadPromise;
expect(download.suggestedFilename()).toBe("mobilityops-audit.csv");
});
test("privacy centre refuses anonymisation of a customer with an active booking", async ({ page, request }) => {
await resetAndLogin(request, page);
await page.goto("/privacy");
await page.getByLabel("Klantreferentie").first().fill("CUS-0042");
await page.getByLabel("Gemotiveerde reden").fill("Gevalideerd verzoek van de betrokkene");
await page.getByLabel(/Typ CUS-0042 ter bevestiging/).fill("CUS-0042");
await page.getByRole("button", { name: "Definitief anonimiseren" }).click();
await expect(page.getByText(/kon niet worden uitgevoerd/)).toBeVisible();
});