-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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]: Clock mocking impacting page click events #31924
Comments
Can you try manually hosting the dev server with |
I can reproduce. Seems related to our |
@EwenDC @mxschmitt will follow your methods |
Ideally we generate the timestamp when the Event gets created. This patch adds a best-effort logic, since we can't override the constructor of natively created events, e.g. `MouseEvent`. Fixes #31924
Not sure the fix works for this?
Still fails with |
works for me, I think because you are not installing the latest |
18:09:22 ~/projects/Playwright-Clock-Bug (main) $ npm run test -- --version
> playwright-clock-bug@0.0.0 test
> playwright test --version
Version 1.47.0-alpha-2024-08-19
18:09:28 ~/projects/Playwright-Clock-Bug (main) $ npm list --depth=5 | grep playwright
playwright-clock-bug@0.0.0 /Users/cooper667/projects/Playwright-Clock-Bug
├─┬ @playwright/test@1.47.0-alpha-2024-08-19
│ └── playwright@1.47.0-alpha-2024-08-19 deduped
├─┬ playwright@1.47.0-alpha-2024-08-19
│ └── playwright-core@1.47.0-alpha-2024-08-19 Seems correct? |
Looks indeed good. How does your output/error look like when you run your tests? For me its: expected to fail but passed after our fix. |
Yea, all good now, sorry |
Version
1.45.3
Steps to reproduce
npm install
npm test
command.Expected behavior
The test "works without mock clock" should pass, and the test "fails with mock clock" should fail, as the only difference between the two tests is the use of
page.clock
(which should have no effect on the functionality of this demo app)Actual behavior
Both tests pass, as when the mocked clock is installed and time is fast forwarded, the select list within the dialog stops receiving click events.
Additional context
This is a minimal reproduction based off a legacy Vue 2 application maintained at our company. We recently decided to use
page.clock
to speed up our end-to-end tests by allowing us to skip minutes of idle time waiting for frontend polling events. However, once we addedpage.clock
to our tests, some of our tests started failing for reasons unrelated to the polling.Namely, we had a test involving verifying the values shown in a select list within a dialog. Before adding a
clock.fastForward
call, this test worked fine. However, after adding theclock.fastForward
call, the select list became totally unresponsive to click events. We also sporadically observed this behaviour in other parts of the UI (even beforeclock.fastForward
was called), namely in icon buttons with tooltips. These buttons would fail to register clicks if you clicked directly on the icon, but would still register clicks against the button whitespace. I have included both listed scenarios in the reproduction, but unfortunately I was not able to get the failed icon button click to reliably trigger.We observed these scenarios both within test executions, and when manually interacting with the test browsers in debug mode. Interestingly, I observed that when using debug mode, it was possible to get the select list to work by calling
.click()
on the<div>
with the classel-input
that surrounds the<input>
element. This leads me to believe the root cause of this issue is page events not properly propagating whenpage.clock
is in use, though I have no idea why that would be the case.Environment
The text was updated successfully, but these errors were encountered: