Open any toolbox from a list in Sokko TCG's toolbox drawer
Every Sokko TCG section now offers the top bar's toolbox button. Instead of linking a toolbox, the drawer lists all toolboxes (linked to a game or not) as wide rows with a large cover, opens the one chosen, and remembers it on the device. Memos and alerts follow the toolbox shown. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
e8fe27a90f
commit
8253f74c90
17 changed files with 359 additions and 45 deletions
|
|
@ -4,6 +4,7 @@ import { tmpdir } from "node:os";
|
|||
import { join } from "node:path";
|
||||
import { DatabaseSync } from "node:sqlite";
|
||||
import { expect, test } from "@playwright/test";
|
||||
import { readStoredSnapshot } from "./helpers/storage.js";
|
||||
|
||||
// Sélecteurs à choix unique du design system (`SelectDropdown`).
|
||||
const selectTrigger = (scope, label) => scope.getByRole("button", { name: new RegExp(`^${label} : `) });
|
||||
|
|
@ -2705,3 +2706,58 @@ test("an administrator opens the broken mirror and a player rebuilds the easy an
|
|||
await page.getByRole("dialog").getByRole("button", { name: "Fermer", exact: true }).click();
|
||||
await expect(status).toContainText("Fermé aux joueurs");
|
||||
});
|
||||
|
||||
test("the Sokko TCG drawer opens any toolbox from a list and remembers the choice", async ({ page }) => {
|
||||
test.setTimeout(60_000);
|
||||
await page.setViewportSize({ width: 1600, height: 900 });
|
||||
await page.goto("/#/cards/guild");
|
||||
await page.getByRole("button", { name: "Version développement", exact: true }).click();
|
||||
await expect(page.locator(".nebula-quests")).toBeVisible();
|
||||
const drawer = page.locator("#toolbox-drawer");
|
||||
const openedTitle = (name) => drawer.getByRole("heading", { level: 1, name, exact: true });
|
||||
const createInDrawer = async (name) => {
|
||||
await drawer.getByRole("button", { name: "Nouvelle toolbox", exact: true }).click();
|
||||
await page.getByRole("textbox", { name: "Nom", exact: true }).fill(name);
|
||||
await page.getByRole("button", { name: "Créer", exact: true }).click();
|
||||
await expect(openedTitle(name)).toBeVisible();
|
||||
};
|
||||
|
||||
// Sans toolbox, le tiroir propose d'en créer une : elle s'y ouvre sans quitter le jeu.
|
||||
await page.getByRole("button", { name: "Afficher la toolbox", exact: true }).click();
|
||||
await expect(drawer).toContainText("Aucune toolbox pour l’instant.");
|
||||
await createInDrawer("Notes TCG");
|
||||
await expect(page).toHaveURL(/#\/cards\/guild$/);
|
||||
|
||||
// Passer de la Guilde aux Expéditions garde la toolbox ouverte.
|
||||
await page.goto("/#/cards/expeditions");
|
||||
await expect(page.getByRole("button", { name: "Masquer la toolbox", exact: true })).toHaveAttribute("aria-pressed", "true");
|
||||
await expect(openedTitle("Notes TCG")).toBeVisible();
|
||||
|
||||
// « Changer de toolbox » ramène à la liste, d'où l'on en crée ou en ouvre une autre.
|
||||
await drawer.getByRole("button", { name: "Changer de toolbox", exact: true }).click();
|
||||
await expect(drawer.getByRole("heading", { name: "Quelle toolbox ouvrir ?" })).toBeVisible();
|
||||
await expect(drawer.locator(".drawer-toolbox-chooser-row")).toHaveText(["Notes TCGToolbox libre"]);
|
||||
await createInDrawer("Build");
|
||||
|
||||
// Le choix est retenu : après un rechargement, le tiroir rouvre directement « Build » (une fois la toolbox enregistrée).
|
||||
await expect.poll(async () => (await readStoredSnapshot(page)).toolboxes.map((toolbox) => toolbox.name)).toContain("Build");
|
||||
await page.reload();
|
||||
await page.getByRole("button", { name: "Afficher la toolbox", exact: true }).click();
|
||||
await expect(openedTitle("Build")).toBeVisible();
|
||||
|
||||
// Une toolbox liée à un jeu reste disponible dans Sokko TCG, sans perdre sa liaison. La liste suit l'ordre de la page Toolboxes.
|
||||
await page.goto("/#/games/mhwilds");
|
||||
await page.getByRole("button", { name: "Afficher la toolbox", exact: true }).click();
|
||||
await drawer.getByLabel("Toolbox disponible").selectOption({ label: "Notes TCG" });
|
||||
await drawer.getByRole("button", { name: "Associer", exact: true }).click();
|
||||
await expect(openedTitle("Notes TCG")).toBeVisible();
|
||||
await page.goto("/#/cards/collection");
|
||||
await page.getByRole("button", { name: "Afficher la toolbox", exact: true }).click();
|
||||
await drawer.getByRole("button", { name: "Changer de toolbox", exact: true }).click();
|
||||
await expect(drawer.locator(".drawer-toolbox-chooser-row")).toHaveText(["BuildToolbox libre", "Notes TCGMonster Hunter Wilds"]);
|
||||
await drawer.getByRole("button", { name: /^Notes TCG/ }).click();
|
||||
await expect(openedTitle("Notes TCG")).toBeVisible();
|
||||
await page.goto("/#/games/mhwilds");
|
||||
await page.getByRole("button", { name: "Afficher la toolbox", exact: true }).click();
|
||||
await expect(openedTitle("Notes TCG")).toBeVisible();
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue