// Rôle : vérifie en navigateur que la home charge les zones principales. import { expect, test } from "@playwright/test"; import { resetSokkoStorage } from "./helpers/storage.js"; test.beforeEach(async ({ page }) => resetSokkoStorage(page)); test("home page renders the application shell", async ({ page }) => { await page.goto("/"); await expect(page.locator(".app-shell")).toBeVisible(); const main = page.getByRole("main"); const hero = main.locator(".hero"); await expect(main).toBeVisible(); await expect(main.getByRole("heading", { name: "Sokko G", exact: true })).toBeVisible(); const create = hero.getByRole("button", { name: "Créer ma première toolbox", exact: true }); await expect(create).toBeVisible(); await expect(main.getByRole("link", { name: "Voir les jeux", exact: true })).toBeVisible(); await expect(page.locator(".home-stats")).toBeVisible(); await expect(page.locator(".origin-section")).toBeVisible(); await create.click(); await expect(page.getByRole("dialog", { name: "Nouvelle toolbox", exact: true })).toBeVisible(); }); test("home links to the toolbox list once a toolbox exists", async ({ page }) => { await page.locator(".hero").getByRole("button", { name: "Créer ma première toolbox", exact: true }).click(); const dialog = page.getByRole("dialog", { name: "Nouvelle toolbox", exact: true }); await dialog.getByRole("textbox", { name: "Nom", exact: true }).fill("Accueil contextualisé"); await dialog.getByRole("button", { name: "Créer", exact: true }).click(); await page.goto("/#/"); const link = page.getByRole("main").getByRole("link", { name: "Voir mes toolboxes", exact: true }); await expect(link).toBeVisible(); await link.click(); await expect(page).toHaveURL(/#\/toolboxes$/); });