I am trying to trigger a MUI Select using Cypress but I cannot get it to work.
I have read the MUI SelectInput source and it is clear they are triggering on "mousedown" event. I have profiled a click and seen that this is true. However, calling cy.find(input).trigger('mousedown', { force: true }) doesn't trigger the popup, nor does cy.find('label').trigger('mousedown', { force: true }), nor does grabbing any of the containing div elements and triggering mousedown on them.
If I go to the MUI example page: https://material-ui.com/components/selects/ and I inspect the DOM there and look at the elements, none of them have an onmousedown handler, and grabbing them as globals and calling temp<n>.dispatchEvent(new MouseEvent('mousedown')) doesn't trigger the popup to open. So I cannot figure out where the mousedown handler is being hooked.
What am I missing?
Thanks in advance.
findByText(from Cypress Testing Library) and docy.findByText("Text of the Select label or current selected value").click().findByText("Text of option we want to select").click().cy.get('div.MuiSelect-root').first().type('{downarrow}{enter}')