Closed Vannevelj closed 4 years ago
I've worked around this by putting both <Image>
and <Text>
on the same level in the view and adding flexDirection: row
to the layout.
That looks the same visually and allows the tests to pass so I'm curious whether the issue here was a case of invalid nesting or whether there's a bug inside RNTL that doesn't correctly search these nested situations?
If I change it to subject.getByText('[object Object]Hello');
then it does work. It looks like
is perhaps not the right choice? I'm not really sure how the toString()
is supposed to work on a component but I'm guessing that the current behaviour is not as intended.
FYI, this repository is no longer responsible for this package. See the migration guide to v7.0.
I've got the following test:
If I take out the
<Image>
, then it does find the text and the test passes. I've seen this issue which seems very much related but it sounds like this should have been fixed: https://github.com/callstack/react-native-testing-library/issues/142Am I using the API incorrectly?