All Questions
Tagged with react-native-testing-library react-native
166 questions
1
vote
0
answers
44
views
SyntaxError: C:\zero\node_modules\react-native\Libraries\Components\Touchable\TouchableOpacity.js: Missing initializer in const declaration
I'm trying to write tests for my React Native app (using TypeScript). All my unit tests pass without issues, but when writing component tests, I encounter the following error:
● ButtonComponent › ...
0
votes
0
answers
27
views
Test react-hook-form with react-native-testing-library error
I am trying to test an input value in my form, my form also contains a drop down list component - I keep getting the warning:
Warning: Function components cannot be given refs. Attempts to access ...
2
votes
0
answers
188
views
Issue with @testing-library after adding Select component from gluestack-ui v.2
I'm facing an issue where my test fails to find an element by text after I added the Select UI component from gluestack-ui to my React Native component.
Before adding the Select, my test works fine:
...
2
votes
0
answers
90
views
ReferenceError: expect is not defined ( react-native , @testing-library/react-native )
I have been facing two issues mainly
console.error
Warning: React.createElement: type is invalid -- expected a string (for built-in
components) or a class/function (for composite components) but ...
0
votes
0
answers
82
views
How to handle react component being unmounted on user press in unit testing
I am writing Jest tests for my react native application. When I use user.press function, I get the following error:
Unable to find node on an unmounted component.
at findCurrentFiberUsingSlowPath (...
1
vote
0
answers
164
views
How to fix jest error Cannot find module '../Utilities/Platform' from 'node_modules/react-native/Libraries/StyleSheet/processColor.js'
I want to running jest to test my component, I'm using React Native Testing Library to test and React Native Web to create an example. Whenever I tried to run jest I facing an error like this:
● Test ...
0
votes
0
answers
35
views
React Native + Jest + React Native Testing Library errors
I'm having trouble with a proper config for the following setup: React Native + Jest + React Native Testing Library. Trying to follow the docs and similar issues solutions, nothing works as expected ...
-1
votes
1
answer
253
views
Getting error in Component testing - Jest & react-native testing library
Getting error when using the render method to test component
`Trying to detect host component names triggered the following error:
Unexpected token 'export'
There seems to be an issue with your ...
0
votes
1
answer
336
views
How can I change a TextInput's selection and fire its onSelectionChange event in unit testing?
I have a React Native component with a TextInput that I'm testing. Part of the behaviour of this component relies on handling the current selection position via onSelectionChange — that is, it matters ...
0
votes
1
answer
211
views
TouchableOpacity fails on second render with React Native Testing Library
When I test component containing TouchableOpacity with React-Native testing library, first time render is ok, second time in test suite test always fails.
If I replace TouchableOpacity with ...
2
votes
0
answers
881
views
React Native testing library "`render` method has not been called" occurs sporadically
We just recently did a React Native upgrade to 0.72.4 on our project and therefore updated the versions of the testing libraries as well. These are the versions they're at right now:
Relevant ...
0
votes
2
answers
591
views
getAllByRole does not find input element in react native testing library
I have a simple component with two inputs and one button. I was able to test the code with getAllByRole func for buttons. But when I want to find input elements, I got below error :
Unable to find an ...
4
votes
1
answer
2k
views
babel config setup for testing
I have setup testing in my react native app with typescript using React-native-testing-library. I have configured my babel,config.js as below. There is an odd issue though.
module.exports = {
...
3
votes
1
answer
4k
views
React Native Unit Testing - Can't access .root on unmounted test renderer
Hello I'm testing my app with react-native-testing-library. When i run test returning test fail How can i solve this? Error is:
Can't access .root on unmounted test renderer
There seems to be an ...
1
vote
1
answer
312
views
React Native Unit Testing [closed]
I have a few questions about react-native-testing-library.
I want to implement unit tests on my app by using react-native-testing-library.
I run my LoginScreen component using the render() method and ...