Skip to content

Click event triggered twice #5380

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

Closed
hd-esteban opened this issue Jul 30, 2020 · 9 comments
Closed

Click event triggered twice #5380

hd-esteban opened this issue Jul 30, 2020 · 9 comments
Assignees
Labels
AREA: client FREQUENCY: level 2 SYSTEM: automations TYPE: bug The described behavior is considered as wrong (bug).
Milestone

Comments

@hd-esteban
Copy link

hd-esteban commented Jul 30, 2020

Hi

I have a test case where we expected the zoom module to be opened when the user clicks on the zoom button. It works on mobile when I tap the button manually. The problem I'm facing is when I run the test on a real mobile device using the remote tool from test cafe. The zoom panel is opened and then closed, I checked the events and the button is getting clicked twice.

The double click does not happen on desktop devices, or when I click/tap it manually you can verify it at:

http://test-viewer.kristianhristov.com/test/A2-simple-with-zoom.html

(On desktop devices zoom button is not displayed, but zoom module opens when you click the viewport)


const testCaseName = `Zoom`;

fixture(testCaseName).page('http://test-viewer.kristianhristov.com/test/A2-simple-with-zoom.html');

test("Zoom panel should be opened when clicked", async t => {
    let mainZoomCnt = await Selector('.cylindo-zoom-imagery').parent();
    
    await t.wait(20000).click(Selector('.threesixty-button'));

    await t.debug();

    await t
        .wait(10000)
        .expect(mainZoomCnt.exists).ok()
        .expect(mainZoomCnt.visible).ok();
});
  • testcafe version: 1.8.5

  • node.js version: v10.13.0

  • command-line arguments: testcafe "remote" "-S" "-s" "artifacts/screenshots" "-p" "${USERAGENT}${FIXTURE}_${TEST}.png" "test/spec/complete/A1-*.spec.ts" "--app" "node test/serve.js" "--speed" "1" "--quarantine-mode" "--qr-code"

  • browser name and version: Chrome mobile 84.0.4147.105

  • platform and version: Huawei mate 20 lite

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Jul 30, 2020
@wentwrong
Copy link
Contributor

I changed the test code and was able to reproduce the issue: a click event on the zoom button (which appears only with a mobile version) is triggered twice.

This test fails although it shouldn't:

import { Selector } from 'testcafe';

const testCaseName = `Zoom`;

fixture(testCaseName).page('http://test-viewer.kristianhristov.com/test/A2-simple-with-zoom.html');

test("Zoom panel should be opened when clicked", async t => {
    const zoomPanel = await Selector('.cylindo-zoom-imagery');
    
    await t
        .expect(zoomPanel.visible)
        .notOk('Zoomed viewport should not be visible before click on zoom button');

    await t.click(Selector('.threesixty-button'));

    await t
        .expect(zoomPanel.visible)
        .ok('Zoomed viewport should be visible after click on zoom button');
});

It is possible to run the following command:

npx testcafe "chrome:emulation:device=iPhone 4" test.js 

(or use the remote mode)

Thank you for bringing this to our attention. We'll update this issue when we have any news.

@need-response-app need-response-app bot removed the STATE: Need response An issue that requires a response or attention from the team. label Jul 31, 2020
@wentwrong wentwrong added AREA: client STATE: Need research SYSTEM: automations TYPE: bug The described behavior is considered as wrong (bug). labels Jul 31, 2020
@hd-esteban
Copy link
Author

@wentwrong any ETA for this issue? This is really urgent for us and this is not the only event that is being triggered twice, some other clicks are being triggered multiple times too...

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Jul 31, 2020
@LavrovArtem LavrovArtem added this to the Planned milestone Aug 3, 2020
@LavrovArtem
Copy link
Contributor

Unfortunately, at the moment we cannot give any ETA for this bug. Once we have news to report, we will notify you here.

@need-response-app need-response-app bot removed the STATE: Need response An issue that requires a response or attention from the team. label Aug 3, 2020
@hd-esteban
Copy link
Author

hd-esteban commented Aug 3, 2020

Hi @LavrovArtem thanks for your quick reply.

Do you think it is important to list you some other examples where I noticed the same behavior here?

One more thing that I think is important to mention is that we have enabled touch and click events at the same time in case users have devices with touch screen and mouse. This is because we don't know which device will be used to execute the functionality, so, we have both listeners enabled. Internally we handle it with preventDefaults, stopPropagation and stopImmediatePropagation, etc.

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Aug 3, 2020
@Farfurix
Copy link
Contributor

Farfurix commented Aug 4, 2020

@Esteban26

Hello,

Do you think it is important to list you some other examples where I noticed the same behavior here?

At present, we have all the information we need to process this issue. If you encounter any other issues after the fix is published, please report them.

This is because we don't know which device will be used to execute the functionality, so, we have both listeners enabled.

Thank you for the information. Our goal in this case is not to break the native behavior.

@need-response-app need-response-app bot removed the STATE: Need response An issue that requires a response or attention from the team. label Aug 4, 2020
@alexey-lin alexey-lin self-assigned this Aug 4, 2020
@AlexKamaev
Copy link
Contributor

To the team:
I researched the issue. It occurs because the zoom view is toggled on two events: touchend and  mousedown. It is shown on touchend and then it's immediately closed on mousedown. However,  without TestCafe it works, since the target site calls the preventDefault method on the touchend event, so mousedown is not raised. Thus, to fix the issue, we need to support the case when the preventDefault method is called on the touchend event to prevent mousedown.

@hd-esteban
Copy link
Author

Hi @AlexKamaev, do you have any update on this issue?

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Oct 1, 2020
@arubtsov
Copy link
Contributor

arubtsov commented Oct 2, 2020

Hello @Esteban26,

There are no updates yet.

@need-response-app need-response-app bot removed the STATE: Need response An issue that requires a response or attention from the team. label Oct 2, 2020
@wentwrong wentwrong self-assigned this Oct 2, 2020
@wentwrong wentwrong modified the milestones: Planned, Sprint #66 Oct 5, 2020
@hd-esteban
Copy link
Author

thanks!

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Jan 7, 2021
@AlexSkorkin AlexSkorkin removed the STATE: Need response An issue that requires a response or attention from the team. label Jan 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AREA: client FREQUENCY: level 2 SYSTEM: automations TYPE: bug The described behavior is considered as wrong (bug).
Projects
None yet
Development

No branches or pull requests

8 participants