Stabilize Playwright pointer interactions after lazy loading
All checks were successful
Validate and deploy Sokko G / validate (push) Successful in 18m11s
Validate and deploy Sokko G / deploy (push) Successful in 10s

This commit is contained in:
Shinuwa 2026-10-30 14:14:23 +01:00
parent 9242becb1d
commit 4cb6487f85
12 changed files with 59 additions and 38 deletions

View file

@ -1,5 +1,6 @@
// Rôle : vérifie la gestion, la limite et les déplacements entre espaces toolbox.
import { expect, test } from "@playwright/test";
import { movePointerTo, startPointerDrag } from "./helpers/pointer.js";
import { resetSokkoStorage } from "./helpers/storage.js";
async function seedToolbox(page, toolbox, links = {}) {
@ -20,10 +21,8 @@ async function addSpace(page, name) {
}
async function dragModuleToTab(page, title, tab, hoverMs = 0) {
await page.getByRole("button", { name: `Déplacer ${title}`, exact: true }).hover();
await page.mouse.down();
const box = await tab.boundingBox();
await page.mouse.move(box.x + box.width / 2, box.y + box.height / 2, { steps: 4 });
await startPointerDrag(page, page.getByRole("button", { name: `Déplacer ${title}`, exact: true }));
await movePointerTo(page, tab, { steps: 4 });
if (hoverMs) await page.waitForTimeout(hoverMs);
await page.mouse.up();
}
@ -143,12 +142,10 @@ test("shows the tab insertion indicator on the correct side while reordering", a
});
const farmTabWrap = page.getByRole("tab", { name: "Farm" }).locator("..");
const farmBox = await farmTabWrap.boundingBox();
const bossDragHandle = page.getByRole("button", { name: "Réordonner l’espace Boss" });
await expect.poll(() => bossDragHandle.evaluate((element) => globalThis.getComputedStyle(element).marginLeft)).toBe("4px");
await bossDragHandle.hover();
await page.mouse.down();
await page.mouse.move(farmBox.x + farmBox.width - 2, farmBox.y + farmBox.height / 2, { steps: 4 });
await startPointerDrag(page, bossDragHandle);
await movePointerTo(page, farmTabWrap, { x: 0.98, steps: 4 });
await expect(farmTabWrap).toHaveClass(/is-drop-target/);
await expect(farmTabWrap).toHaveClass(/drop-after/);
await expect.poll(() => farmTabWrap.evaluate((element) => globalThis.getComputedStyle(element, "::before").right)).toBe("0px");