Skip to content

Commit

Permalink
test: deflake tween mouse test (puppeteer#1515)
Browse files Browse the repository at this point in the history
When mojo is enabled for input events, we sometimes get an extra mouse move after the page is created. Moving the mouse ourselves makes the test consistent. The same behavior also caused DevTools dispatchMouseEvent to become flaky, but that will be fixed with: https://chromium-review.googlesource.com/c/chromium/src/+/804357
  • Loading branch information
JoelEinbinder authored and aslushnikov committed Dec 4, 2017
1 parent 2becd15 commit c58c70e
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2207,16 +2207,15 @@ describe('Page', function() {
await page.click('a');
}));
it('should tween mouse movement', SX(async function() {
await page.mouse.move(100, 100);
await page.evaluate(() => {
window.result = [];
document.addEventListener('mousemove', event => {
window.result.push([event.clientX, event.clientY]);
});
});
await page.mouse.move(100, 100);
await page.mouse.move(200, 300, {steps: 5});
expect(await page.evaluate('result')).toEqual([
[100, 100],
[120, 140],
[140, 180],
[160, 220],
Expand Down

0 comments on commit c58c70e

Please sign in to comment.