A J
A J

Reputation: 1545

hover on svg in cypress and test tooltip

Scenario:

I have something similar

<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
  <!-- Using g to inherit presentation attributes -->
  <g fill="white" stroke="green" stroke-width="5">
    <circle cx="40" cy="40" r="25" />
    <circle cx="60" cy="60" r="25" />
  </g>
</svg>

Hovering over svg will show a tooltip and I need to test whether tooltip is displayed and the content is correct.

Any suggestions? Tried trigger(mouseover) which in not working

Upvotes: 0

Views: 2386

Answers (1)

A J
A J

Reputation: 1545

cy.get(svg).trigger('focus')

worked for me

Upvotes: 2

Related Questions