Stabilize persisted toolbox interaction tests
Some checks failed
Validate Sokko G / validate (push) Failing after 12m39s

This commit is contained in:
Shinuwa 2026-10-23 18:19:27 +02:00
parent a767616db4
commit ce58a21ba7
2 changed files with 13 additions and 0 deletions

View file

@ -16,6 +16,16 @@ function entry(tool, label) {
return tool.locator(".calculator-entry").filter({ has: tool.page().getByRole("button", { name: `Supprimer ${label}`, exact: true }) });
}
async function storedScrollPreference(page) {
return page.evaluate(async () => {
const db = await import("/src/utils/indexedDbStorage.js");
const snapshot = await db.getToolboxSnapshot();
const toolbox = snapshot.toolboxes.find((item) => item.modules.some((module) => module.type === "calculator"));
const calculator = toolbox?.modules.find((module) => module.type === "calculator");
return snapshot.moduleData[`${toolbox?.id}:${calculator?.id}`]?.scrollResults === true;
});
}
async function saveRoot(tool, formula, label) {
await tool.getByRole("textbox", { name: "Calcul", exact: true }).fill(formula);
await tool.getByLabel("Libellé", { exact: true }).fill(label);
@ -123,10 +133,12 @@ test("reset clears only the draft, new calculation returns to root, and clipboar
const scroll = tool.getByRole("button", { name: "Liste scrollable", exact: true });
await expect(scroll).toHaveAttribute("aria-pressed", "false");
await scroll.click();
await expect.poll(() => storedScrollPreference(page)).toBe(true);
await page.reload();
await expect(scroll).toHaveAttribute("aria-pressed", "true");
await expect(tool.locator(".calculator-tree")).toHaveCSS("overflow-y", "auto");
await scroll.click();
await expect.poll(() => storedScrollPreference(page)).toBe(false);
await page.reload();
await expect(scroll).toHaveAttribute("aria-pressed", "false");
await expect(tool.locator(".calculator-entry")).toHaveCount(3);

View file

@ -112,6 +112,7 @@ test("pointer selections move blocks and insert ranges into formulas without cha
await expect(cell(table, "B3")).toHaveValue("6");
await cell(table, "C2").dblclick();
await cell(table, "C2").fill("=");
await cell(table, "C2").press("End");
await drag(page, cell(table, "A1"), cell(table, "B1"));
await expect(cell(table, "C2")).toHaveValue("=(A1+B1)");
await cell(table, "C2").press("Enter");