Skip to content

Commit b840229

Browse files
committed
test(drag-element): update comments
1 parent f6c4aee commit b840229

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

core/src/utils/test/playwright/drag-element.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,19 @@ const moveElement = async (page: E2EPage, startX: number, startY: number, dragBy
139139

140140
await page.mouse.move(middleX, middleY);
141141

142-
// Safari needs to wait for a repaint to occur before moving the mouse again.
142+
/**
143+
* In Safari, gesture velocity is calculated relative to animation frames.
144+
* Without waiting for a repaint, consecutive `mouse.move` events arrive
145+
* with ~0ms time delta and velocity never accumulates, causing gesture
146+
* detection to fail.
147+
*/
143148
if (browser === 'webkit' && i % 2 === 0) {
144-
// Repainting every 2 steps is enough to keep the drag gesture smooth.
145-
// Anything past 4 steps will cause the drag gesture to be flaky.
149+
/**
150+
* Repaintng every 2 steps is enough to keep the drag gesture smooth.
151+
* Repainting on every step makes the test slow, and repainting every
152+
* 4+ steps means Safari does not see enough frames to track the gesture
153+
* reliably.
154+
*/
146155
await page.evaluate(() => new Promise(requestAnimationFrame));
147156
}
148157
}

0 commit comments

Comments
 (0)