Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion core/src/utils/test/playwright/drag-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,16 @@ export const dragElementBy = async (
// initiates text selection on mouse.down(). In Playwright, this selection
// locks in before the gesture detector fires, blocking pointer events.
// Clearing it here allows the drag gesture to proceed normally.
await page.evaluate(() => window.getSelection()?.removeAllRanges());
//
// This is scoped to Firefox because the extra page.evaluate() is an awaited
// round-trip that adds variable latency between mouse.down() and the first
// mouse.move(). Chromium and WebKit don't need the selection clear, and on
// WebKit that latency perturbs the timing-derived gesture velocity, causing
// the item to settle a few pixels off and flaking screenshot comparisons
// (e.g. item-sliding safe-area tests).
if (page.context().browser()?.browserType().name() === 'firefox') {
await page.evaluate(() => window.getSelection()?.removeAllRanges());
}

// Drag the element.
await moveElement(page, startX, startY, dragByX, dragByY);
Expand Down
Loading