Detox: Detox will not tap button because it says that it is not visible enough.
Description
I have a screen where there is a button to switch views. In my tests, detox finds the button by testID but tells me that the button is not visible. Screenshots and logs below to give more context and detail.
- [X ] I have tested this issue on the latest Detox release and it still reproduces
Reproduction
- I don’t know how exactly one could reproduce it as it is a specific implementation but I have tried moving the testID to various different elements including the TouchableOpacity’s parent View and the TO’s inner Text component and I get the same error messages each time.
Expected behavior
I am trying to select the button shown below. It is expected that detox will find the button and tap it.
Screenshots



Environment (please complete the following information):
- Detox: 17.6.0
- React Native: 0.61.2
- Node: 12.18.3
- Device: iPhone 11
- Xcode: 11.3.1
- iOS: 13.3
- macOS: 11
Logs
Test Failed: View “<RCTView: 0x7fa08ded38f0>” is not visible: view does not pass visibility threshold (75%)
TIP: To print view hierarchy on failed actions/matches, use loglevel verbose and above.
94 | await element(by.id('CreateOrder')).tap();
95 |
> 96 | await element(by.id('SwitchLabelRight')).tap();
| ^
97 |
98 | // await scrollToElement('ScrollView', `${orderQuantity}-Pack`, 'down');
99 | // await element(by.id(`${orderQuantity}-Pack`)).tap();
Device and verbose Detox logs
- I have run my tests using the
--loglevel trace
argument and am providing the verbose log below: Test Failed: View “<RCTView: 0x7fc93b762dd0>” is not visible: view does not pass visibility threshold (75%) View Hierarchy: <Remove by Leo>
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 14
- Comments: 26 (12 by maintainers)
I’ll push my debug tool in a few minutes, where we’ll be able to better look at what Detox sees.