user-event

user-event is a companion library for Testing Library that provides more advanced simulation of browser interactions than the built-in fireEvent method.

npm install --save-dev @testing-library/user-event
import { screen } from '@testing-library/dom'
import userEvent from '@testing-library/user-event'
test('types inside textarea', () => {
document.body.innerHTML = `<textarea />`
userEvent.type(screen.getByRole('textbox'), 'Hello, World!')
expect(screen.getByRole('textbox')).toHaveValue('Hello, World!')
})

Known limitations

  • No <input type="color" /> support. #423
Last updated on by Matan Borenkraout