https://cypress.io logo
.rightclick() on Google Maps not triggering custom...
# i-need-help
a
Hi all, I'm currently struggling on an issue in one of our tests. We have a wrapper component that loads in a Google Maps map and I'm trying to trigger our custom contextmenu with
.rightclick()
- but to no avail. Tried dispatching an event on the element itself, didn't trigger it either. What does work is executing the
.rightclick()
twice - but this does seem hacky.
h
According to the docs, the element must reach "actionable" state https://docs.cypress.io/api/commands/rightclick#The-element-must-first-reach-actionability . Are you sure this happens before you call
rightclick()
?
a
Even tried it with a
cy.wait(10000)
to be sure
h
Hmm, have you tried focusing that element first?
a
I've tried focusing our custom Angular element and even the div that holds all the event listeners for Google Maps. None of it triggers the contextmenu
.trigger('contextmenu')
didn't work either
b
since you already have a workaround, not sure if this would make a huge difference but I wonder if clicking via
cypress-real-events
might help out in this case. https://github.com/dmtrKovalenko/cypress-real-events#cyrealclick
4 Views