Reputation: 1251
I am trying to click an element (ellipsis) that will appear after the mouse-enter event on a particular list element but the test fails with the following error.
Timed out retrying after 4050ms: cy.click() failed because this element is not visible:
<button id="optionsButton">...</button>
This element <button#optionsButton> is not visible because it has CSS property: display: none
Fix this problem, or use {force: true} to disable error checking
My code:
cy.get("voy-vessel-gsis-list-entry")
.find('.container')
.eq(0)
.should('be.visible')
.trigger("mouseenter")
.find('#optionsButton')
.click()
I also checked similar questions in sof and tried invoke('show')
but none worked (so far).
Here is the DOM:
when mouse hover/enter event on .container
:
when no mouse event:
Upvotes: 0
Views: 1906
Reputation: 18650
You can use the cypress-real-events plugin. This will work with all chromium browsers, which means firefox will not work.
1.Install the plugin with npm install cypress-real-events
2.Then add in cypress/support/index.js
import "cypress-real-events/support";
3.Then you can use realHover('mouse')
.
cy.get("voy-vessel-gsis-list-entry")
.find('.container')
.eq(0)
.realHover('mouse')
.find('#optionsButton')
.should('be.visible')
.click()
Upvotes: 1