I have a select with options defined as below:
<Select
labelId="select1"
data-testid="select1"
label="select 1"
name="select 1"
multiple={true}
>
<MenuItem data-testid={`select1_option`} key="select1_1`} value="1">Option 1</MenuItem>
<MenuItem data-testid={`select1_option`} key="select1_2`} value="2">Option 2</MenuItem>
</Select>
I am getting the select element with (cant get it by role as element has no name):
const filter1 = await screen.getByTestId('select1');
user.click(filter1);
But I cant then access the options to select them. I have tried
userEvent.selectOptions(filter1, '1');
fireEvent.change(filter1, { target: { value: 1 } })
const options = screen.getAllByTestId("select1_option")
But none of these work. What should I do?