Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@testing-library/user-event

Package Overview
Dependencies
Maintainers
15
Versions
199
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@testing-library/user-event

Fire events the same way the user does

  • 14.5.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9.8M
decreased by-2.02%
Maintainers
15
Weekly downloads
 
Created

What is @testing-library/user-event?

The @testing-library/user-event package is a library built on top of @testing-library/dom that simulates user interactions with the DOM. It allows developers to write tests that mimic user behavior in a way that is consistent with how a user would use a web application. This helps ensure that tests are realistic and that the application will work as expected when real users interact with it.

What are @testing-library/user-event's main functionalities?

Typing text into an input element

Simulates typing text into an input field or other element that can receive input.

userEvent.type(screen.getByRole('textbox'), 'Hello, World!')

Clicking elements

Simulates a click event on a button, link, or any other clickable element.

userEvent.click(screen.getByText('Submit'))

Selecting options in a select element

Simulates selecting an option from a dropdown select element.

userEvent.selectOptions(screen.getByRole('combobox'), 'optionValue')

Uploading files

Simulates a file upload interaction on an input of type file.

userEvent.upload(screen.getByLabelText('Upload'), file)

Tabbing through elements

Simulates tabbing through focusable elements on the page.

userEvent.tab()

Other packages similar to @testing-library/user-event

Keywords

FAQs

Package last updated on 29 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc