30 lines
1.1 KiB
TypeScript
30 lines
1.1 KiB
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("Tour d'accueil première visite", () => {
|
|
test.beforeEach(async ({ context }) => {
|
|
await context.addInitScript(
|
|
(keys: { consent: string; tour: string }) => {
|
|
localStorage.setItem(keys.consent, "analytics-rejected");
|
|
localStorage.removeItem(keys.tour);
|
|
},
|
|
{ consent: CONSENT_STORAGE_KEY, tour: WELCOME_TOUR_STORAGE_KEY }
|
|
);
|
|
});
|
|
|
|
test("modale visible sur / puis fermeture via bouton principal", async ({ page }) => {
|
|
await page.goto("/");
|
|
const dialog = page.locator("#welcome-tour-dialog");
|
|
await expect(dialog).toBeVisible({ timeout: 15_000 });
|
|
await page.getByRole("button", { name: /Commencer|Get started|시작하기|开始使用/i }).click();
|
|
await expect(dialog).toBeHidden();
|
|
});
|
|
|
|
test("pas de modale sur une URL recette partagée", async ({ page }) => {
|
|
await page.goto("/r/base%3Aonigiri/variant%3Aonigiri-kimchi-mozza");
|
|
await expect(page.locator("#welcome-tour-dialog")).toHaveCount(0);
|
|
});
|
|
});
|