-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
cy.click() doesn’t select element in custom dropdown component #5805
Comments
I have the same issue. |
The actual assertion should be checking the cy.get("[name=foods]").should("have.value", "Beef"); Regardless, this is a regression that was introduced in 3.5.0 and has not been fixed as of 3.8.1. ReproRun this repo: https://github.com/Sharan-ram/cypress-bug-demo and change last assertion to cy.get("[name=foods]").should("have.value", "Beef"); 3.4.13.5.0All of the mouse click events seem to be happening on 3.8.13.8.1 indicates the exact same mouse event behavior WorkaroundDowngrade to 3.4.1 of Cypress. |
@jennifer-shehane I did some digging into this issue yesterday.
So for the rest of the command the popover just stays towards the left we click on html element. I did this testing with |
Ran across this other issue with material-ui today, thought I would comment in case it sheds some light. #5826 (comment) |
Turns out that I just had to |
This issue still exists in Cypress 4.10.0. |
I confirmed that the behavior @vramana said is true. 'mousemove' event does move autocomplete window to the left. This behavior didn't happen before 3.5.0 because When you comment out the line below: cypress/packages/driver/src/cy/mouse.js Line 362 in 4977450
The test works correctly. And the 'mousemove' event is sent at: cypress/packages/driver/src/cy/mouse.js Line 726 in 4977450
This 'mousemove' event changes the style of popper. It removes the transform: Before mousemove: After mousemove: And these values are computed by |
I found the cause. It's because of the click event simulation. In native settings, the code flow after clicking menu is like this:
In Cypress settings, the code flow is like this:
As you can see, update() is not called. That's why the element is not relocated below the text field. Although we know what the problem is, the solution is a bit hard. We need to give time for browsers to execute event handlers after an event is fired. To do so, we might need to restructure Maybe, native event(#311) can be the solution. |
In case this helps anyone else, my workaround for Material UI Autocomplete is to use keyboard controls to select the item. For example, to select the first item: cy.get('.my-material-autocomplete input').type('{downarrow}{enter}') |
@binary-koan 's solution worked for me.
|
I also have the same issue with version 8.2.0. |
Also for Cypress 10.3.1 |
Passing According to the docs the |
this works with my popper |
This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided. |
This issue has been closed due to inactivity. |
Current behavior:
With the update to 3.5.0, Cypress doesnt seem to select the right MenuItem from the Material ui Popper. The cy.click() is applied to the right element but the actual element clicked is wrong. I have made a sample demo app reproducing the issue and a screenshot has been attached below:
Desired Behaviour:
cy.click() should be applied to the right element
Steps to reproduce:
Here is a sample repo which reproduces the issue. Run npm run cypress:open, select app.test.js file, you can see on the console that applied to is different from actual element clicked.
Versions
Cypress 3.5.0, reproducible even in v3.6.1
Browser Chrome
The text was updated successfully, but these errors were encountered: