MCPcopy Create free account
hub / github.com/testing-library/user-event

github.com/testing-library/user-event

Chat with this repo
repository ↗ · DeepWiki ↗ · release v14.6.13 ↗ · + Follow · compare 4 versions
472 symbols 1,393 edges 189 files 2 documented · 0% ● updated 2mo agov14.6.7 · 2026-09-02★ 2,32895 open issues

Browse by type

⨍ Functions 369◇ Types & classes 103
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

user-event

dog

Fire events the same way the user does

Read The Docs

Build Status Code Coverage version downloads MIT License All Contributors PRs Welcome Code of Conduct Discord

[!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.

Contributors

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

License

MIT

Extension points exported contracts — how you extend this code

browse all types & interfaces →

Core symbols most depended-on inside this repo

browse all functions →

Shape

Function 270
Method 99
Class 69
Interface 28
Enum 6

Languages

TypeScript100%

Modules by API surface

src/event/createEvent.ts44 symbols
src/utils/dataTransfer/DataTransfer.ts24 symbols
src/system/keyboard.ts20 symbols
tests/_helpers/listeners.ts19 symbols
src/utils/dataTransfer/Clipboard.ts19 symbols
testenv/modules/fakeTimers.ts18 symbols
src/system/pointer/mouse.ts16 symbols
src/system/pointer/index.ts16 symbols
src/setup/directApi.ts16 symbols
src/document/UI.ts15 symbols
src/system/pointer/pointer.ts10 symbols
src/utils/focus/cursor.ts9 symbols

Dependencies from manifests, versioned

@esbuild-plugins/node-modules-polyfill0.2.2 · 1×
@eslint/compat1.2.5 · 1×
@ph.fritsche/eslint-config3.0.0-beta.13 · 1×
@ph.fritsche/scripts-config2.4.0 · 1×
@ph.fritsche/toolbox1.0.0-alpha.11 · 1×
@testing-library/react16.1.0 · 1×
@types/jest-in-case1.0.3 · 1×
@types/react18.0.25 · 1×
@types/sinonjs__fake-timers8.1.2 · 1×
css.escape1.5.1 · 1×

For agents

$ claude mcp add user-event \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page