Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
U

user-event

> 前端框架
Open source

Simulate user events

2.3K stars0 likes1 views
WebsiteGitHub

About

Simulate user events

[!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 userEvent from vitest/browser that 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.

The problem

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

The solution

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.

Issues

Looking to contribute? Look for the Good First Issue label.

Bugs

Please file an issue for bugs, missing documentation, or unexpected behavior.

See Bugs

Feature Requests

Please file an issue to suggest new features. Vote on feature requests by adding a . This helps maintainers prioritize what to work on.

See Feature Requests

❓ Questions

For questions related to using the library, please visit a support community instead of filing an issue on GitHub.

  • Discord
  • Stack Overflow

Contributors

We most sincerely thank the people who make this project possible. Contributions of any kind are welcome!

License

MIT

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

TypeScriptdomfrontendjavascripttesting

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category前端框架
PricingOpen source

> Related tools

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架