Skip to content

Add helper function for cross-browser mouse move events

Background

Currently, mouse move events in our Cypress chart tests are handled differently across browsers, particularly in Edge. We need a consistent way to handle these events in our tests. For more context, see !5045 (comment 2739090627).

Proposal

Create a helper function crossBrowserMouseMove that handles mouse move events appropriately based on the browser:

export const crossBrowserMouseMove = (el) => {
  if (Cypress.browser.name === 'edge') {
    el.click()
  } else {
    el.trigger('mousemove')
  }
}

Could also potentially make it a Cypress command.

Edited by Rudy Crespo