Stabilize Playwright pointer interactions after lazy loading
This commit is contained in:
parent
9242becb1d
commit
4cb6487f85
12 changed files with 59 additions and 38 deletions
24
e2e/helpers/pointer.js
Normal file
24
e2e/helpers/pointer.js
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
// 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 });
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue