Testing Library

Testing Library

  • Docs
  • Recipes
  • Help
  • Blog

›Ecosystem

Getting Started

  • Introduction
  • Guiding Principles

Frameworks

    DOM Testing Library

    • Introduction
    • Install
    • Example
    • Setup
    • Queries
    • Firing Events
    • Async Utilities
    • Helpers
    • Configuration
    • FAQ
    • Cheatsheet

    React Testing Library

    • Introduction
    • Example
    • Setup
    • API
    • FAQ
    • Cheatsheet

    Reason Testing Library

    • Introduction
    • Examples

    Native Testing Library

    • Introduction
    • Example
    • Setup
    • API

    Vue Testing Library

    • Introduction
    • Examples
    • Setup
    • API
    • Cheatsheet
    • FAQ

    Marko Testing Library

    • Introduction
    • Setup
    • API

    Angular Testing Library

    • Introduction
    • Examples
    • API

    Preact Testing Library

    • Introduction
    • Example
    • API
    • Learn

    Svelte Testing Library

    • Introduction
    • Setup
    • Example
    • API
  • Cypress Testing Library
  • Puppeteer Testing Library
  • Testcafe Testing Library
  • Nightwatch Testing Library

Ecosystem

  • user-event
  • jest-dom
  • bs-jest-dom
  • jest-native
  • react-select-event
  • eslint-plugin-testing-library
  • eslint-plugin-jest-dom
  • riot-testing-library
Edit

user-event

user-event is a companion library for React 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 React from 'react'
import { render } from '@testing-library/react'
import userEvent from '@testing-library/user-event'

test('click', async () => {
  const { getByRole } = render(<textarea />)

  await userEvent.type(getByRole('textbox'), 'Hello, World!')
  expect(getByRole('textbox')).toHaveAttribute('value', 'Hello, World!')
})
  • user-event on GitHub
Last updated on 5/18/2020
← Nightwatch Testing Libraryjest-dom →
Testing Library
Docs
Getting StartedExamplesAPIHelp
Community
BlogStack OverflowDiscord
More
StarGitHubEdit Docs on GitHubHosted by Netlify
Copyright © 2018-2020 Kent C. Dodds and contributors