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

[test-runner-commands] reset-mouse command is broken with newer versions of puppeteer #2262

Closed
melink14 opened this issue May 4, 2023 · 4 comments · Fixed by #2375 or #2379
Closed

Comments

@melink14
Copy link
Contributor

melink14 commented May 4, 2023

This is broken since v19.10.1 (due to puppeteer/puppeteer#10021) and unfortunately wasn't marked as a breaking change and so is in scope of the current version designation of the puppeteer package.

The breakage is caused by these lines:

await page.mouse.up({ button: 'left' });

In latest versions of puppeteer, it's an error to call up if the mouse button is not actually pressed.

Users can implement their own reset commands to compensate (based on actual use) but I think the only easy common reset implementation would be to use try...catch to prevent bubbling expected errors.

@melink14 melink14 changed the title [test-runner-commands] reset-mouse command is broken with latest versions of puppeteer [test-runner-commands] reset-mouse command is broken with newer versions of puppeteer May 4, 2023
@dlockhart
Copy link
Contributor

I'm seeing this as well. Another alternative solution perhaps: track whether the 3 mouse buttons are up or down and then reset-mouse would only call mouse.up for the ones that require it.

@web-padawan
Copy link
Contributor

web-padawan commented May 23, 2023

This also affects unit tests with sendMouse that we use in Vaadin web components:

Error: 'left' is not pressed.
    at Mouse.up (/Users/serhii/vaadin/web-components/node_modules/@web/test-runner-chrome/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Input.js:518:19)
    at Object.executeCommand (/Users/serhii/vaadin/web-components/node_modules/@web/test-runner-commands/dist/sendMousePlugin.js:114:38)
    at TestRunnerApiPlugin._onCommand (/Users/serhii/vaadin/web-components/node_modules/@web/test-runner-core/dist/server/plugins/api/testRunnerApiPlugin.js:145:108)

Update: the last working version is 19.9.0 and the change was introduced in 19.9.1.

@melink14
Copy link
Contributor Author

melink14 commented Jul 2, 2023

The reset command was added in puppeteer/puppeteer#10340 and it looks like it's been released since puppeteer-core: v20.7.3 and browsers: v1.4.2 so I think this problem could be fixed with another update to those deps and then chaning the commands code to use reset instead of manually calling the mouse commands.

I guess since the deps are new major versions (some sort of breaking change) then it would mean the modernweb package would also need a new major version?

@web-padawan
Copy link
Contributor

it would mean the modernweb package would also need a new major version?

Yes, we probably should update to these versions and use await page.mouse.reset() directly.
This would mean releasing @web/test-runner-commands version 0.8.0 due to major bump.

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