Add checklist switching and contextual memo ticker
All checks were successful
Deploy Sokko G / deploy (push) Successful in 19s

This commit is contained in:
Shinuwa 2026-09-28 09:40:29 +02:00
parent 273bc5d528
commit bd4059c9c1
16 changed files with 231 additions and 28 deletions

View file

@ -132,6 +132,12 @@ for (const width of [1280, 390]) {
await page.goto(route);
await page.getByRole("searchbox").fill("emberpup");
const card = page.locator(".aniimo-result");
const pageControls = page.locator(".guide-checklist-page-controls");
const unlinkedSelect = pageControls.getByRole("combobox", { name: "Checklist associée", exact: true });
await expect(pageControls).toBeVisible();
await expect(unlinkedSelect).toHaveValue("");
await expect(unlinkedSelect).toContainText("Choisir une checklist");
await expect(pageControls.getByRole("button")).toHaveCount(0);
await openDrawer(page);
await expect(activeButtons(page)).toHaveCount(0);
await expect(page.locator(".guide-checklist-controls")).toHaveCount(3);
@ -164,7 +170,6 @@ for (const width of [1280, 390]) {
expect(actionsBounds.x + actionsBounds.width / 2).toBeCloseTo(bounds.x + bounds.width / 2, 0);
await page.screenshot({ path: test.info().outputPath("linked-drawer.png") });
await closeDrawer(page);
const pageControls = page.locator(".guide-checklist-page-controls");
await expect(pageControls).toBeVisible();
const pageControlsBounds = await pageControls.boundingBox();
const pageHeadingBounds = await page.locator(".page-heading").boundingBox();
@ -175,6 +180,14 @@ for (const width of [1280, 390]) {
expect(headingActionsBounds.height).toBeCloseTo(pageHeadingBounds.height, 0);
expect(pageControlsBounds.y).toBeCloseTo(pageHeadingBounds.y, 0);
}
const checklistSelect = pageControls.getByRole("combobox", { name: "Checklist associée", exact: true });
await expect(checklistSelect).toHaveValue("forms");
await expect(checklistSelect.locator("option")).toHaveCount(3);
await expect(checklistSelect.locator('option[value="unrelated"]')).toHaveCount(0);
await checklistSelect.selectOption("capture");
await expect(checklistSelect).toHaveValue("capture");
await checklistSelect.selectOption("forms");
await expect(checklistSelect).toHaveValue("forms");
await expect(pageControls.getByRole("button", { name: "Masquer les cochés", exact: true })).toHaveAttribute("aria-pressed", "false");
await expect(pageControls.getByRole("button", { name: "Dissocier la checklist", exact: true })).toBeVisible();
await expect(card).toHaveAttribute("data-checklist-complete", "true");

56
e2e/memos-ticker.spec.js Normal file
View file

@ -0,0 +1,56 @@
// Rôle : vérifie la bande de mémos fixe sur les pages de toolbox et de jeu associées.
import { test, expect } from "@playwright/test";
import { resetSokkoStorage } from "./helpers/storage.js";
async function seedMemosToolbox(page) {
await resetSokkoStorage(page);
await page.evaluate(async () => {
await new Promise((resolve, reject) => {
const request = globalThis.indexedDB.open("sokkog", 1);
request.onsuccess = () => {
const db = request.result;
const tx = db.transaction(["kv", "modules"], "readwrite");
tx.objectStore("kv").put([
{ id: "memo-toolbox", name: "Toolbox mémos", modules: [{ id: "memos", type: "memos", title: "Mémos" }], moduleColumns: 1 }
], "toolboxes");
tx.objectStore("kv").put({ mhwilds: "memo-toolbox" }, "links");
tx.objectStore("modules").put({
key: "memo-toolbox:memos",
data: { items: [{ id: "memo-1", text: "Préparer les potions", color: "#f6c453" }] }
});
tx.oncomplete = () => { db.close(); resolve(); };
tx.onerror = () => reject(tx.error);
};
request.onerror = () => reject(request.error);
});
});
await page.reload();
}
test("shows and persists the memo ticker on linked game and full toolbox pages", async ({ page }) => {
await seedMemosToolbox(page);
await page.goto("/#/games/mhwilds/monsters");
const globalTicker = page.locator(".global-memos-ticker");
await expect(globalTicker).toBeVisible();
await expect(globalTicker).toContainText("Préparer les potions");
await expect(globalTicker).toHaveCSS("position", "fixed");
await page.goto("/#/games/aniimo/aniimos");
await expect(globalTicker).toHaveCount(0);
await page.goto("/#/toolbox/memo-toolbox");
await expect(globalTicker).toBeVisible();
const toggle = page.locator(".memos-ticker-toggle");
await expect(toggle).toHaveAccessibleName("Masquer la bande");
await toggle.click();
await expect(globalTicker).toHaveCount(0);
await page.reload();
await expect(globalTicker).toHaveCount(0);
await expect(toggle).toHaveAccessibleName("Afficher la bande");
await toggle.click();
await expect(globalTicker).toBeVisible();
await page.goto("/#/toolboxes");
await expect(globalTicker).toHaveCount(0);
});