-
-
Notifications
You must be signed in to change notification settings - Fork 417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't use user events from React Native Testing Library since Tamagui elements won't fire the correct events #2614
Comments
@mfrfinbox the repro scenario is missing The root cause why RNTL User Event is not invoking press event is that in the rendered host components tree, there is no press-related handler ( See host element tree from the original RNTL issue. |
I've update the repro scenario, thanls for pointing this out @mdjastrzebski , also I can make it work like this but it feels very hacky and I would likle to use user events instead if possible:
Additionally if you read the description of the problem there are 2 issues:
Please let me know if you need more info |
thanks for the details, I'll check this tommorow |
I also had an issue with using user events from RNTL with Tamagui components. Looks like the issue is caused by the fact that Jest doesn't account for the /**
* Custom Jest resolver
* @param {string} path
* @param {import('jest-resolve').ResolverOptions} options
* @returns {string}
*/
exports.sync = function nativeResolver(path, options) {
const defaultResolverResult = options.defaultResolver(path, options);
if (path.startsWith('@tamagui')) {
return defaultResolverResult.replace('index.js', 'index.native.js');
}
return defaultResolverResult;
}; |
Any updates on this? I'm currently unable to test a user journey due to being unable to check the required checkboxes. Tried @DimitarNestorov's solution which resulted in:
Anymore information on how you made the custom resolver work? |
@Cowner we don't have an import for if (path.startsWith('@tamagui') && !path.includes("@tamagui/polyfill-dev") { |
@DimitarNestorov could you explain details what your custom resolver does? Shouldn't that be responsibility of RN Jest preset?
|
Current Behavior
While testing my components I am trying to use user events https://callstack.github.io/react-native-testing-library/docs/user-event
I am trying to use user event because it resembles the user interaction, I've opened an issue on RNTL github but they believe the issue might be on this side and since Tamagui codebase is complex they couldn't figue this out, here's the link to the comment I've made callstack/react-native-testing-library#1566 (comment)
Expected Behavior
user event should trigger as expected
Tamagui Version
Platform (Web, iOS, Android)
Reproduction
System Info
The text was updated successfully, but these errors were encountered: