Is the `user-event` library compatible with React Native Testing Library?

415 Views Asked by At

Can anyone confirm whether the user-event library is compatible with React Native Testing Library?

I'm guessing not, as the user-event docs say

the library can be used with any framework as long as there is a DOM

and the React Native Testing Library docs say

does not run in a browser environment...unlike other wrappers that use DOM Testing Library as the base.

and also that they use fireEvent in all their examples in the docs.

But I don't know much about the internals of how Native apps actually run, so I don't know whether there is actually some sort of DOM that user-event could use.

Would love confirmation from someone more knowledgeable.

1

There are 1 best solutions below

0
Andrew On BEST ANSWER

It looks like an equivalent User Event API has been added to React Native Testing Library itself, in version 12.2.0 and is in beta (as of Aug 2023) -

https://callstack.github.io/react-native-testing-library/docs/user-event