Okay, so I'm brand new to react-native-testing as of this morning and have not been able to do something as simple as do getByText()
. So, I'm not going to claim this issue is a bug with the library, but a "bug" with my basic understanding of how to use it. Please help me see what I'm missing? Thanks.
Given this jest test file in my React Native 0.67.2 app:
import React from 'react'; import { Text } from 'react-native'; import { cleanup, render, RenderAPI } from '@testing-library/react-native'; describe('react-native-test example', () => { let c: RenderAPI; beforeEach(() => { c = render(<Text>example</Text>); }); afterEach(cleanup); test('getByText()', () => { c.debug(); expect(c.getByText('example')).toBeDefined(); }); });
Why do I get this result?
I also tried <Text>{'example'}</Text>
and getByText(/example/)
to no avail.
"react": "~17.0.2",
"@testing-library/jest-native": "^4.0.4",
"@testing-library/react-native": "^9.0.0",
"jest": "^25.1.0",
Xorko, dirkpostma, protoEvangelion and statico
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4