'Why is my testing input not working with react-native-testing?
Why I get this error when I want to test my input:
expect(received).toEqual(expected) // deep equality
Expected: "asdasd"
Received: {"_fiber": {"_debugHookTypes": null, "_debugID": 263, "_debugNeedsRemount": false, "_debugOwner": [FiberNode], "_debugSource": null, "actualDuration": 0, "actualStartTime": -1, "alternate": [FiberNode], "child": null, "childLanes": 0, "dependencies": null, "elementType": "TextInput", "firstEffect": null, "flags": 4, "index": 0, "key": null, "lanes": 0, "lastEffect": null, "memoizedProps": [Object], "memoizedState": null, "mode": 0, "nextEffect": null, "pendingProps": [Object], "ref": null, "return": [FiberNode], "selfBaseDuration": 0, "sibling": null, "stateNode": [Object], "tag": 5, "treeBaseDuration": 0, "type": "TextInput", "updateQueue": null}}
Test.js
it('should change the email text and password and press the login button', async () => {
const { debug, getByTestId } = render(
<Provider store={store}>
<NavigationContainer>
<Auth route={{params: {
isLogin: true
}}} />
</NavigationContainer>
</Provider>);
await act(async () => {
fireEvent.changeText(getByTestId('username_input'), 'asdasd');
})
await waitFor(() => {
expect(getByTestId('username_input')).toEqual('asdasd');
})
});
What I am doing wrong and how can I solve this issue ?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
