Use `testing-library/dom` instead of `testing-library/react` in the test utils so they can be used with real browser tests
- Dominant language
- TypeScript
- Stars
- 15.9k
- Forks
- 1.6k
- Avg merge
- 3d 9m
- Merged PRs (30d)
- 59
Description
See discussion below, we'd like to investigate the possibility having the test utils work with real browser tests. So far it seems like we need to allow the user to pass in their own `act` perhaps.
### Discussed in https://github.com/adobe/react-spectrum/discussions/9684
Originally posted by **stevegreco** February 19, 2026
I have a question around the usage of `@react-aria/test-utils` and `testing-library`. I know that it utilizes `testing-library` internally, but does that mean we have to utilize it as well in our project?
We have recently been experimenting with `vitest-browser-react` instead of `testing-library`. The main problem I see is when assigning the `root` element.
```ts
// testing-library
const select = user.createTester("Select", {
root: screen.getByTestId("select"),
interactionType: interaction,
});
```
```ts
// vitest-browser-react
const combobox = user.createTester("ComboBox", {
root: screen.getByTestId("combobox").element() as HTMLElement,
interactionType: interaction,
});
```
This will sometimes cause errors like
```
Error: Listbox with id of null not found in document.
```
I know this package is still in beta, but I am curious if anyone has gotten this working
Contributor guide
Assessment
This issue has not been assessed yet.