Skip to content

Instantly share code, notes, and snippets.

@cmathew
Last active May 5, 2021 00:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmathew/d8be2e07d28dbf9fd9258a08dad2a2ca to your computer and use it in GitHub Desktop.
Save cmathew/d8be2e07d28dbf9fd9258a08dad2a2ca to your computer and use it in GitHub Desktop.
BottomSheet ViewAction for Espresso
class BottomSheetSetStateAction(
@BottomSheetBehavior.State private val desiredState: Int
) : ViewAction {
override fun getConstraints(): Matcher<View> {
return Matchers.any(View::class.java)
}
override fun perform(uiController: UiController, view: View) {
val bottomSheetBehavior = BottomSheetBehavior.from(view)
bottomSheetBehavior.state = desiredState
}
override fun getDescription(): String = "Set BottomSheet to state: $desiredState"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment