Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Webkit mouse wheel scrolling not working in headless mode #15566

Closed
ivy-lli opened this issue Jul 12, 2022 · 4 comments · Fixed by #16000
Closed

[BUG] Webkit mouse wheel scrolling not working in headless mode #15566

ivy-lli opened this issue Jul 12, 2022 · 4 comments · Fixed by #16000
Assignees

Comments

@ivy-lli
Copy link

ivy-lli commented Jul 12, 2022

Context:

  • Playwright Version: 1.23
  • Operating System: Linux
  • Node.js version: 16.15.0
  • Browser: WebKit
  • Extra: headless

Code Snippet

I've created a small test for this:

test('webkit scroll headless', async ({ page }) => {
    await page.goto('https://playwright.dev/');
    const getStartBtn = page.locator('.getStarted_Sjon');
    await expect(getStartBtn).toBeVisible();
    const bounds = await getStartBtn.boundingBox();
    await page.mouse.wheel(0, 100);
    const scrolledBounds = await getStartBtn.boundingBox();
    expect(bounds!.y).not.toEqual(scrolledBounds!.y);
});

with the config:

let config: PlaywrightTestConfig = {
  use: {
    // headless: false,
    browserName: 'webkit'
  }
};

Describe the bug

The mouse wheel scrolling seems to be defect in the webkit headless mode. If I run the above test with chromium or firefox it works in headful and headless mode. With webkit it only works in the headful mode.

ivy-lli added a commit to axonivy/process-editor-client that referenced this issue Jul 12, 2022
- Mouse wheel should scroll up and down
- Mouse wheel + shift should scroll right and left
- Mouse wheel + ctrl should zoom
- Adjust zoom level a bit
- Run webkit in headed mode (with xvfb), because the mouse wheel scrolling is not working in headless mode: microsoft/playwright#15566
@yury-s
Copy link
Member

yury-s commented Jul 12, 2022

The test is actually flaky, it fails every second run for me on chromium macos with the error below. Do you have a standalone example where the scroll issue can be reproduced?


   Expected: not 322


       8 |   await page.mouse.wheel(0, 100);
       9 |   const scrolledBounds = await getStartBtn.boundingBox();
    > 10 |   expect(bounds!.y).not.toEqual(scrolledBounds!.y);```

@ivy-lli
Copy link
Author

ivy-lli commented Jul 13, 2022

Hm... You're right.
The problem is that my page is a little bit complex. So I tried to reproduce it with a demo project.

It seems the the problem only happens if the event listener is attached to a svg element: https://github.com/ivy-lli/playwright-webkit-headless-wheel-bug/blob/master/src/test.html#L23-L27

If also add a test which checks that the scrolling only gets applied if the mouse is over the svg box: https://github.com/ivy-lli/playwright-webkit-headless-wheel-bug/blob/master/tests/example.spec.ts

If I run this tests, everything is working correctly, except with the headless webkit browser:
image

I hope this helps.

@aslushnikov
Copy link
Collaborator

Speculatively assigning to Yury so that it doesn't fall through the cracks!

@ivy-lli
Copy link
Author

ivy-lli commented Jul 28, 2022

Thanks a lot for your work! Playwright is an awesome piece of software 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants