import { test, expect } from "@playwright/test"; test.describe("Consent banner", () => { test("banner shows and can be accepted", async ({ page, context }) => { // Start clean await context.clearCookies(); await page.goto("/en", { waitUntil: "domcontentloaded" }); // Banner should appear on public pages when no consent is set yet const bannerTitle = page.getByText(/Privacy settings|Datenschutz-Einstellungen/i); await expect(bannerTitle).toBeVisible({ timeout: 10000 }); // Accept all const acceptAll = page.getByRole("button", { name: /Accept all|Alles akzeptieren/i }); await acceptAll.click(); // Banner disappears await expect(bannerTitle).toBeHidden({ timeout: 10000 }); // Cookie is written const cookies = await context.cookies(); const consentCookie = cookies.find((c) => c.name === "dk0_consent_v1"); expect(consentCookie).toBeTruthy(); }); });