-
Notifications
You must be signed in to change notification settings - Fork 273
Migration guide from @testing-library/react-native is missing some breaking changes #477
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
Comments
Hey! I think we can definitely add some of these back. I'm not so sure about parentNode because it smells like testing implementation details. I'll be away from keyboard till next week, but I'm sure you can discuss it with @mdjastrzebski @Esemesek and @cross19xx and figure out the way forward 🙂 |
Yes, I agree. I think we can probably get around it in our codebase by adding a matcher that recursively checks parents for the appropriate styles. |
Also: |
Also the |
Hey @TAGraves would you be so kind and create some action points / issues for us to implement? For example I also noticed that you were a collaborator to the second library, so if you'd like to gain more privileges in this repo, please give me a shout at Discord ( |
re |
+1 for baseElement/Container. We use that at our company as a way to get at top level component which is useful in some cases where you don't have any specific text/content to query for |
Another behavior that I noticed while doing migration is:
Appreciate direction if I am not using the new lib correctly |
@dephiros Please post sample test code of how are you using AFAIK |
I think we could introduce something similar to |
Thank you for your response
view.debug() (very similar to the previous version except the previous version has the extra wrapper)
|
Here is an attempt to track all the functionality that IMO we should try to get in for v8 Missing functionality in v7 that was present in v6:
Bugs in v7:
Misc:
What we can probably ignore until we have further information:
|
Closing as stale. In case anyone involved considers any of the above mentioned points as a bug or missing feature, please fill a separate pull request for each item. |
Hey all,
Stoked to see the two react-native testing libraries have finally merged! At Root, we have a fair number of testing library tests in our react native project. I tried upgrading @testing-library/react-native from v6 to v7 and about 20% of our tests are failing after following the upgrade guide.
Another engineer will be taking a closer look at the upgrade (I was just trying to get an idea of the effort involved), but looking through the errors I see at least the following undocumented breaking changes:
getByLabelText(...).getProp is not a function
(see https://www.native-testing-library.com/docs/next/api-test-instance#getprop) -- this one is obviously replaced with.props
insteadbaseElement is undefined
(see https://www.native-testing-library.com/docs/next/api-main#baseelement)parentNode is undefined
(see https://www.native-testing-library.com/docs/api-test-instance#parentnode) -- this one is really important for us as we use it a lot for testing styles in cases where we can guarantee what the "native" parent will be. From a quick check I'm not sure if there is a new equivalent (.parent
behaves differently since there's no concept of a NativeTestInstance now)string precision options are missing (see https://www.native-testing-library.com/docs/next/api-queries#precision)
If there are existing ways to migrate from these old patterns to the new ones, we'd love to hear it and see it added to the migration guide. If not -- we'd likely be happy to contribute to add some of this functionality back in!
The text was updated successfully, but these errors were encountered: