I'm having some problems that I'm not able to test the MUI dropdown. I'm getting this error: Unable to find an accessible element with the role "option" and name "/ninica/i"
I have an example code here: https://codesandbox.io/s/react-testing-library-material-ui-dropdown-5knbgu
My test:
test("select", () => {
render(<App />);
// Get and click in the dropdown
const dropdownButton = screen.getByRole("button", { name: /dog name /i });
fireEvent.click(dropdownButton);
// Get and click in the dropdown item
const dropdownItem = screen.getByRole("option", { name: /ninica/i });
fireEvent.click(dropdownItem);
});
I already try to use getByTestId but have the same result, can't find.