sokko-g/e2e/helpers/pointer.js
Shinuwa 4cb6487f85
All checks were successful
Validate and deploy Sokko G / validate (push) Successful in 18m11s
Validate and deploy Sokko G / deploy (push) Successful in 10s
Stabilize Playwright pointer interactions after lazy loading
2026-10-30 14:14:23 +01:00

24 lines
935 B
JavaScript

// Rôle : stabilise les gestes pointeur Playwright face aux chargements différés et aux déplacements de mise en page.
import { expect } from "@playwright/test";
export async function waitForLazyModules(page) {
await expect(page.locator(".module-loading-fallback")).toHaveCount(0);
}
export async function startPointerDrag(page, source) {
await expect(source).toBeVisible();
await waitForLazyModules(page);
await source.scrollIntoViewIfNeeded();
const box = await source.boundingBox();
expect(box).not.toBeNull();
await page.mouse.move(box.x + box.width / 2, box.y + box.height / 2);
await page.mouse.down();
return box;
}
export async function movePointerTo(page, target, { x = 0.5, y = 0.5, steps = 5 } = {}) {
await target.scrollIntoViewIfNeeded();
const box = await target.boundingBox();
expect(box).not.toBeNull();
await page.mouse.move(box.x + box.width * x, box.y + box.height * y, { steps });
}