Skip to content

Instantly share code, notes, and snippets.

@razir
Created August 29, 2019 17:18
Show Gist options
  • Save razir/b4face95f9f60a373785ac4aeb635ce9 to your computer and use it in GitHub Desktop.
Save razir/b4face95f9f60a373785ac4aeb635ce9 to your computer and use it in GitHub Desktop.
fun withId(id: Int) = onView(ViewMatchers.withId(id))
fun ViewInteraction.isDisplayed() = check(matches(ViewMatchers.isDisplayed()))
fun ViewInteraction.isNotDisplayed() = check(matches(not(ViewMatchers.isDisplayed())))
fun ViewInteraction.hasText(text: Int) = check(matches(ViewMatchers.withText(text)))
fun ViewInteraction.hasText(text: String) = check(matches(ViewMatchers.withText(text)))
fun ViewInteraction.withHint(text: Int) = check(matches(ViewMatchers.withHint(text)))
fun ViewInteraction.typeText(text: String) = perform(ViewActions.typeText(text))
fun ViewInteraction.closeSoftKeyboard() = perform(ViewActions.closeSoftKeyboard())
fun ViewInteraction.click() = perform(ViewActions.click())
fun ViewInteraction.isEnabled() = check(matches(ViewMatchers.isEnabled()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment