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
Click simulates two pointerup events on Android #4837
Comments
Hi @0815Strohhut, Could you please clarify how you run TestCafe tests on an Android device? |
Hi @miherlosev , I am running testcafe on a Windows 10 machine while |
I've reproduced the problem. Thank you for the detailed information.
|
Thanks a lot for the info, I did some investigation and came to the conclusion, that pointerevents seem to be the problem here. I took a deeper look into what Hammerjs is actually doing and noticed that it uses the pointerevents to detect a doubletap. Hence, I simplified the sandbox to show the issue without hammerjs. Accesing the page using a real device, we get exactly one pointerup event when we press the "clickme" div. However, accessing the page using testcafe
we get two pointerup events on android devices. On ios safari or desktop devices, we still get one pointerup event. As far as I can see, Testcafe simulates the "normal" chain of touchstart, touchend, mousedown, mouseup and click. My guess would be that for some reason the Chrome browser maps this to two seperate pointer-event sequences (one for the touchstart+end, one for mousedown + up) - but it is just a guess, I wasn't able to find reliable information on it. Disabling the pointer event handling of hammerjs solves the problem (falling back to handling mouse/touch events). However, as by now pointer events are supported accross all browsers supported by Testcafe, I feel like Testcafe should probably be able to deal with/simulate pointer events as at least I would expect that we will see more people handling pointer events in the future? It feels like a rather large change to me though. |
Thank you for sharing your findings with us. Please give us additional time to discuss them. |
ran into the same problem today. |
Thank you for sharing your workaround. |
For the team: To reproduce the issue without using a real device, use device emulation. Run the test import { Selector } from 'testcafe';
fixture("Bug Repro")
.page(`https://1bq90.csb.app/`)
test("Pointer Events on Android", async t => {
const clickable = Selector("#clickme");
const pointerups = Selector("#pointerup");
await t.click(clickable);
await t.expect(pointerups.textContent).eql("1");
}); two times with the following commands: testcafe chrome test.js
testcafe "chrome:emulation:device=pixel 2" test.js |
Fixed in PR |
What is your Test Scenario?
We have a page that has an element with both an onTap and an onDoubleTap handler using react-hammerjs. I created a sandbox to show the situation.
Then use Testcafe to simulate a "click" on the div.
What is the Current behavior?
On desktop browsers and iOS: the tap counter is increaed by 1, all is fine.
On Android devices: the tap counter is increased by 2, the double tap counter is increased by 1 (tested with Samsung Galaxy Tab S5e with Andoid 9 and some Huawai Tablet running Android 7)
What is the Expected behavior?
Android devices should simulate a single tap.
What is your web application and your TestCafe test code?
The following code for Testcafe will do the trick using the sandbox above:
Note that if you access the page without Testcafe, taping/clicking the "clickme" div works as expected also on Android devices.
Your Environment details:
I'd be happy about any ideas/input/possible causes you can give me as I have spend quite some time already investigating this and don't have any idea what's the issue. As we have quite some double-taps in our code, that breaks a lots of our tests for andoid devices.
It would for example be helpful to get some info how I can debug the code of testcafe itself while running my test to get an idea of whats happening in that scenario.
The text was updated successfully, but these errors were encountered: