Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Espresso test extensions
fun Int.matchView(): ViewInteraction = onView(withId(this))
fun Int.checkVisible(): ViewInteraction = matchView()
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
fun Int.checkInvisible(): ViewInteraction = matchView()
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.INVISIBLE)))
fun Int.checkGone(): ViewInteraction = matchView()
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.GONE)))
// etc etc, add as many of these as you need
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment