
Security News
Happy Birthday, Shai-Hulud
It has been one year since Shai-Hulud made its first appearance on npm.
@testing-library/user-event
Advanced tools
[!IMPORTANT] > Considering this for new tests? If your tests can run in a real browser, prefer that over simulating events in jsdom.
- Vitest Browser Mode includes a
userEventfromvitest/browserthat mirrors this API but drives a real browser (recommended over this package in browser mode).- Playwright has first-class locator actions (
click(),fill(),press(), etc.) with auto-waiting - usually the better choice for E2E and Playwright component tests.This package is still reasonable for jsdom/happy-dom Testing Library tests. Details and recommendations: #1319.
From testing-library/dom-testing-library#107:
[...] it is becoming apparent the need to express user actions on a web page using a higher-level abstraction than
fireEvent
user-event tries to simulate the real events that would happen in the browser
as the user interacts with it. For example userEvent.click(checkbox) would
change the state of the checkbox.
The more your tests resemble the way your software is used, the more confidence they can give you.
Looking to contribute? Look for the Good First Issue label.
Please file an issue for bugs, missing documentation, or unexpected behavior.
Please file an issue to suggest new features. Vote on feature requests by adding a 👍. This helps maintainers prioritize what to work on.
For questions related to using the library, please visit a support community instead of filing an issue on GitHub.
We most sincerely thank the people who make this project possible. Contributions of any kind are welcome! 💚
Selenium WebDriver is a browser automation library. It is more comprehensive than @testing-library/user-event as it can control the browser at a lower level, but it is also more complex and can be overkill for simple DOM interaction tests.
Cypress is an end-to-end testing framework that includes a rich set of methods for simulating user events. It is similar to @testing-library/user-event but is designed for full end-to-end testing and offers a complete testing environment with a browser-based UI.
Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the DevTools Protocol. It is used for browser automation and can perform actions similar to @testing-library/user-event, but it operates at the browser level and can be used for tasks beyond testing, such as web scraping or generating pre-rendered content.
FAQs
Fire events the same way the user does
The npm package @testing-library/user-event receives a total of 33,157,661 weekly downloads. As such, @testing-library/user-event popularity was classified as popular.
We found that @testing-library/user-event demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 18 open source maintainers collaborating on the project.

Security News
It has been one year since Shai-Hulud made its first appearance on npm.

Research
/Security News
Operators behind PolinRider used a compromised GitHub account to plant malware in four development versions of a Packagist package with 700,000+ downloads.

Security News
GitHub Actions now supports cache-mode, a least-privilege control on the Actions cache aimed at the cache poisoning technique behind recent compromises.