SPB Git

Repository Public

console.spec.ts 1.4 KB 22 lines typescript

1// Console d'administration : navigation groupée, sections chargées à la demande, accès refusé hors rôle admin.2import { axeBoth, expect, noOverflow, openAdmin, test } from "./fixtures"34test("navigation de la console : quatre groupes, toutes les sections s'ouvrent", async ({ page }) => {5  await openAdmin(page, "overview")6  const nav = page.locator(".page-nav")7  for (const group of ["Adresses", "API", "Automatisation", "Infrastructure"]) await expect(nav.locator(".page-nav-group", { hasText: group })).toBeVisible()8  const sections: [string, string][] = [9    ["Adresses", "addresses"], ["Clés d'API", "keys"], ["Approbations", "approvals"], ["Explorateur", "explorer"], ["Webhooks", "webhooks"], ["Journal d'utilisation", "usage"],10    ["Règles et filtres", "rules"], ["Réponses automatiques", "autoreply"], ["Messages programmés", "scheduled"], ["Stockage", "storage"], ["Santé", "health"], ["Livraison", "metrics"],11  ]12  for (const [label, id] of sections) {13    await nav.getByRole("link", { name: label, exact: true }).click()14    await expect(page).toHaveURL(new RegExp(`/admin/${id}$`))15    await expect(page.getByRole("heading", { level: 2, name: label })).toBeVisible()16    await expect(nav.getByRole("link", { name: label, exact: true })).toHaveAttribute("aria-current", "page")17  }18  await openAdmin(page, "overview")19  await axeBoth(page, "admin-nav")20  await noOverflow(page)21})22
Files main
Menu

Theme