sokko-g/e2e/production/onboarding.spec.js
Shinuwa 22b397ebfa Document Sokko G's architecture and folders, and move JavaScript file headers to JSDoc @file blocks
Add ARCHITECTURE.md (layers, flows, folder map, glossary), CONTRIBUTING.md
(setup and step-by-step recipes) and a README in each main folder, with an
index of docs/. Convert the 511 JavaScript headers from "// Rôle :" lines to
JSDoc @file blocks, define a three-level header template in website/AGENTS.md
and check the header in tests/file-headers.test.mjs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 09:42:13 +01:00

47 lines
2.5 KiB
JavaScript

/**
* @file Vérifie la visibilité de la prise en main sur le vrai build après création et suppression persistées.
*/
import { test, expect } from "@playwright/test";
import { readFile } from "node:fs/promises";
import { readStoredSnapshot } from "../helpers/storage.js";
const site = JSON.parse(await readFile("website/public/data/site.json", "utf8"));
test("production home hides onboarding after creation and restores it after deleting the last toolbox", async ({ page }) => {
const errors = [];
page.on("pageerror", (error) => errors.push(error.message));
await page.goto("/");
const onboarding = page.getByRole("region", { name: site.home.onboarding.title, exact: true });
await expect(onboarding).toBeVisible();
await expect(page.locator('script[type="module"][src^="/assets/"]')).toHaveCount(1);
await expect(page.locator('script[src*="/@vite/client"]')).toHaveCount(0);
await onboarding.getByRole("button", { name: site.home.onboarding.primaryAction, exact: true }).click();
const dialog = page.getByRole("dialog");
await dialog.getByRole("textbox", { name: "Nom", exact: true }).fill("Production toolbox");
await dialog.getByRole("button", { name: "Créer", exact: true }).click();
await expect(page).toHaveURL(/#\/toolbox\//);
await expect(page.locator('[data-module-type="memos"]')).toBeVisible();
await expect(page.locator('[data-module-type="links"]')).toBeVisible();
await expect.poll(async () => (await readStoredSnapshot(page)).toolboxes.some((toolbox) => toolbox.name === "Production toolbox")).toBe(true);
await page.goto("/#/");
await expect(page.getByRole("heading", { name: site.home.hero.title, exact: true })).toBeVisible();
await expect(onboarding).toHaveCount(0);
await page.reload();
await expect(page.getByRole("heading", { name: site.home.hero.title, exact: true })).toBeVisible();
await expect(onboarding).toHaveCount(0);
await page.goto("/#/about");
await expect(onboarding).toBeVisible();
await page.goto("/#/toolboxes");
await page.getByRole("button", { name: "Supprimer Production toolbox", exact: true }).click();
await page.getByRole("dialog").getByRole("button", { name: "Supprimer", exact: true }).click();
await expect(page.locator(".toolbox-card")).toHaveCount(0);
await expect.poll(async () => (await readStoredSnapshot(page)).toolboxes.length).toBe(0);
await page.goto("/#/");
await expect(onboarding).toBeVisible();
await page.reload();
await expect(onboarding).toBeVisible();
expect(errors).toEqual([]);
});