Skip to content

Instantly share code, notes, and snippets.

@rakib10rr3
Created September 5, 2019 06:02
Show Gist options
  • Save rakib10rr3/8c03a9ded2ba3fa00a6000c2648bcdbb to your computer and use it in GitHub Desktop.
Save rakib10rr3/8c03a9ded2ba3fa00a6000c2648bcdbb to your computer and use it in GitHub Desktop.
class ClickCloseIconAction : ViewAction {
override fun getConstraints(): Matcher<View> {
return ViewMatchers.isAssignableFrom(Chip::class.java)
}
override fun getDescription(): String {
return "click drawable "
}
override fun perform(uiController: UiController, view: View) {
val chip = view as Chip//we matched
chip.performCloseIconClick()
}
}
//call it like this
onView(withId(R.id.chip)).perform(ClickCloseIconAction())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment