Detox: toExist() not working correctly on Android

Describe the bug

When having a FlatList with a few elements horizontally that have to be scrolled through in order to see each of them, using the toExist() expectation for one of the images/elements invisible in the list doesn’t work on Android. The same with attempting to scroll to the element using the whileElement().scroll(), it returns the element not visible exception.

To Reproduce

Steps to reproduce:

  1. Have an app with a FlatList containing several elements horizontally
  2. Put individual IDs on each of them and use the toExist() function on Android for one of the invisible elements
  3. Use the whileElement().scroll() function to attempt to scroll to the last element in the list
  4. Run the same tests on iOS and see them passing

Expected behavior Tests pass and Detox scrolls on the second second test on Android

Environment:

  • Detox: 16.3.0
  • React Native: 0.62.2
  • Node: 14.0.0
  • Device: iPhone 11
  • Xcode: 11.4.1
  • iOS: 13.4.1

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 19 (6 by maintainers)

Most upvoted comments

I confirm that Android Studio layout inspector doesn’t display the non-visible elements in the Flat list, while Xcode does for iOS.

But while/scroll should work regardless if the element exists or not, it should scroll until the element is found.

I can confirm that while / scroll does work as intended on iOS but doesn’t on Android as it requires the element to exist