diff --git a/e2e/toolbox.spec.js b/e2e/toolbox.spec.js index 7bade09..d66ea83 100644 --- a/e2e/toolbox.spec.js +++ b/e2e/toolbox.spec.js @@ -68,6 +68,32 @@ test("creates, edits and deletes a weekly calendar event", async ({ page }) => { await expect(calendar.getByRole("button", { name: /Raid E2E modifié/ })).toHaveCount(0); }); +test("creates a goal tree checklist with more than three visible lines", async ({ page }) => { + await createToolbox(page, "Goal Tree E2E Toolbox"); + await addTool(page, "Arbre d'objectifs"); + + const goalTree = page.locator("[data-module-type='goalTree']"); + await expect(goalTree).toBeVisible(); + await goalTree.getByRole("button", { name: /Afficher l'ajout de Arbre d'objectifs/ }).click(); + await goalTree.getByRole("button", { name: "Ajouter un objectif a la racine" }).click(); + + const editor = goalTree.getByRole("region", { name: "Édition de l'arbre d'objectifs" }); + await expect(editor).toBeVisible(); + await editor.getByLabel("Titre de l'objectif").fill("Farm E2E"); + await editor.getByLabel("Type de l'objectif").selectOption("checklist"); + await editor.getByRole("tab", { name: "Contenu" }).click(); + + for (const index of [1, 2, 3, 4, 5]) { + await editor.getByRole("button", { name: "Ajouter une ligne" }).click(); + await editor.getByLabel("Libellé").nth(index - 1).fill(`Objectif ligne ${index}`); + } + + const previewRows = goalTree.locator(".goal-tree-node-content-row"); + await expect(previewRows).toHaveCount(5); + await expect(previewRows.filter({ hasText: "Objectif ligne 1" })).toBeVisible(); + await expect(previewRows.filter({ hasText: "Objectif ligne 5" })).toBeVisible(); +}); + test("creates a game-linked toolbox from the drawer", async ({ page }) => { await page.goto("/#/games/mhwilds"); await expect(page.getByRole("heading", { name: /Monster Hunter.*Wilds/ })).toBeVisible();