Questions tagged [user-event]

Questions about testing events with the user-event utility.

65 questions
2
votes
1 answer

Testing MUI5 Select with testing-library

I'm using create-react-app 5 (with React 17, Jest, and testing-library), along with MUI 5. I'd like to test clicking a simple Select menu, and making sure the menu options appear. I tried the following: it('shows the menu', async () => { …
JW.
  • 50,691
  • 36
  • 115
  • 143
2
votes
0 answers

How can I use FireEvent's touchStart option in userEvent

I'm studying test using jest, and React testing-library. I have a question about userEvent. There is a touchStart option in fireEvent. How can I use touchStart option in userEvent. fireEvent.touchStart(screen.getByRole('button')); Please let me know
ezdar
  • 45
  • 5
1
vote
1 answer

Cannot find module '@testing-library/dom' from 'node_modules/@testing-library/user-event/dist/click.js' Require stack:

In a project we recently started using userEvent instead of fireEvent but now we are getting this issue FAIL src/modules/DashboardHeader/index.test.tsx            ● Test suite failed to run           Cannot find module '@testing-library/dom' from…
paraS elixiR
  • 1,866
  • 1
  • 18
  • 26
1
vote
1 answer

Is the `user-event` library compatible with React Native Testing Library?

Can anyone confirm whether the user-event library is compatible with React Native Testing Library? I'm guessing not, as the user-event docs say the library can be used with any framework as long as there is a DOM and the React Native Testing…
Andrew
  • 3,825
  • 4
  • 30
  • 44
1
vote
1 answer

testing library userEvent.selectOptions does not select option

I have a React component which renders a combobox (another external component) with an option. When deployed the component does work as expected.