Integrate Prisma for content; enhance SEO, i18n, and deployment workflows
Co-authored-by: dennis <dennis@konkol.net>
This commit is contained in:
27
e2e/consent.spec.ts
Normal file
27
e2e/consent.spec.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
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();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user