cypress: `.click()` doesn't fire `mouseout` event if element is obscured

Current behavior:

In v3.5 a click() action also triggers the mouseover and mouseout events. However, if the element becomes obscured (for example hidden behind a dialog) due to the .click() action the mouseout event is never fired. In some cases, this can leave the UI in a state that will cause later tests to fail.

Note: A workaround is to use .click().trigger('mouseout', { 'force': true }).

Desired behavior:

The mouseout event should trigger if the element becomes obscured… in other words the user can no longer hover. This is the behavior I see in the native browser.

Steps to reproduce: (app code and test code)

  • A button contains a tooltip that obscures another button
  • Clicking on the first button causes a dialog to be shown for 1s.

See: https://github.com/Hypercubed/cypress-test-tiny/blob/5080e0943eb91a5da7c57b34e91f19a7ae8fab07/cypress/integration/spec.js

You will see that in v3.5 (but not v3.4 or native chrome) the tooltip remains even after the dialog opens and obscures the button.

image

Versions

v3.5

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 4
  • Comments: 19 (12 by maintainers)

Most upvoted comments

I’m using .trigger('mouseout', { 'force': true }) in a few places. I still think it would be useful to add an option to not send the additional mouse events.