25 lines
888 B
TypeScript
25 lines
888 B
TypeScript
import { expect, test } from "@playwright/test";
|
||
|
||
const CONSENT_STORAGE_KEY = "ben-to-cookie-consent-v1";
|
||
const WELCOME_TOUR_STORAGE_KEY = "ben-to.welcome-tour-dismissed";
|
||
|
||
test.describe("Bandeau cookies / analytics", () => {
|
||
test.beforeEach(async ({ context }) => {
|
||
await context.addInitScript(
|
||
(keys: { consent: string; tour: string }) => {
|
||
localStorage.removeItem(keys.consent);
|
||
localStorage.setItem(keys.tour, "v1");
|
||
},
|
||
{ consent: CONSENT_STORAGE_KEY, tour: WELCOME_TOUR_STORAGE_KEY }
|
||
);
|
||
});
|
||
|
||
test("le bandeau s’affiche puis disparaît après acceptation", async ({ page }) => {
|
||
await page.goto("/");
|
||
const banner = page.locator(".cookie-consent");
|
||
await expect(banner).toBeVisible();
|
||
await page.getByRole("button", { name: /Accepter|Accept|동의|同意/i }).click();
|
||
await expect(banner).toBeHidden();
|
||
});
|
||
});
|