AdevintaSpain / Barista

:coffee: The one who serves a great Espresso
Other
1.7k stars 120 forks source link

click(R.string.something) doesnt scroll on ExpandableListView #128

Closed crystalknight closed 7 years ago

crystalknight commented 7 years ago

click(R.string.something) throws exception when element with text outside of screen

Sloy commented 7 years ago

Hi @crystalknight. Normal click() methods won't work for list, both in Barista and Espresso. They are a bit special because items outside the screen don't have any Views in the hierarchy yet.

You should try with BaristaListViewActions methods, like clickListViewItem(R.id.listview, 4);.

I don't remember ever using ExpandableListView but it's a subclass of ListView so I hope it will work too.

Sloy commented 7 years ago

If you need a matcher more complex than a position, you might need to use the Espresso API. Check out the docs: https://developer.android.com/training/testing/espresso/lists.html

rocboronat commented 7 years ago

@crystalknight have you tried @Sloy 's solution? Did it workedi

Sloy commented 7 years ago

I'm closing this for inactivity. Feel free to reopen it if you have further problems @crystalknight