FormidableLabs / FormidableLabs/react-native-owl

State always has initial value when submitting in tests

Open
#130 0 comments 3 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
694
Forks
27
PR merge metrics
No merged PRs in 30d

Description

I'm testing out `react-native-owl` and it's great library!
I encountered one strange issue - in my test app I have search input with submit button. Search query is saved in state (with useState). When I press "Search" button, it requests backend and shows results. When I test it with `react-native-owl`, the query is always empty. I added `` with text value and it displays valid value, but when I press submit button and it's empty.
I tried to reproduce it using your demo app https://github.com/FormidableLabs/react-native-owl-demo so I added submit button with `onPress={() => Alert.alert('text from state', text)}` and it's also empty. When I pressed it manually afterwards (during test) it shows valid text.

Tested on iOS simulator and Android emulator.

https://github.com/marcinkornek/react-native-owl-demo-test link to `react-native-owl-demo` with changes mentioned below.

![image](https://user-images.githubusercontent.com/7931279/200515453-8063f6cb-cd37-49fb-bc05-69d7e41defa6.png)

![image](https://user-images.githubusercontent.com/7931279/200515506-489803e6-e44d-44d4-8bb4-e52076cd09fa.png)

Please see videos below:
* when testing it manually in simulator

https://user-images.githubusercontent.com/7931279/200515932-98b425af-de13-4a3c-9c6d-8bd0b92a4326.mov

* when running react-native-owl tests

https://user-images.githubusercontent.com/7931279/200515855-13a9e76c-723a-44db-bb36-624a3c3c3da3.mov

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.