score:7

You should pass the data-testid prop to the inputProps like

<TextField
  select
  id="fruit"
  inputProps={{ id: "fruit", 'data-testid': "fruit" }}
  fullWidth
  variant="outlined"
  {...errors}
>

and then you can do

const fruit = getByTestId('fruit');
fireEvent.change(fruit, { target: { value: 'APPLE' } });

Related Query

More Query from same tag