mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 13:38:49 +03:00
adding expected open/closed state to the bottom sheet waiting
This commit is contained in:
parent
69745ea74e
commit
97d768e392
1 changed files with 8 additions and 3 deletions
|
@ -235,11 +235,16 @@ fun clickOnAndGoBack(@StringRes name: Int, block: () -> Unit) {
|
|||
Espresso.pressBack()
|
||||
}
|
||||
|
||||
inline fun <reified T : VectorBaseBottomSheetDialogFragment<*>> interactWithSheet(contentMatcher: Matcher<View>, noinline block: () -> Unit = {}) {
|
||||
inline fun <reified T : VectorBaseBottomSheetDialogFragment<*>> interactWithSheet(
|
||||
contentMatcher: Matcher<View>,
|
||||
@BottomSheetBehavior.State openState: Int = BottomSheetBehavior.STATE_EXPANDED,
|
||||
@BottomSheetBehavior.State exitState: Int = BottomSheetBehavior.STATE_HIDDEN,
|
||||
noinline block: () -> Unit = {}
|
||||
) {
|
||||
waitUntilViewVisible(contentMatcher)
|
||||
val behaviour = (EspressoHelper.getBottomSheetDialog<T>()!!.dialog as BottomSheetDialog).behavior
|
||||
withIdlingResource(BottomSheetResource(behaviour, BottomSheetBehavior.STATE_EXPANDED), block)
|
||||
withIdlingResource(BottomSheetResource(behaviour, BottomSheetBehavior.STATE_HIDDEN)) {}
|
||||
withIdlingResource(BottomSheetResource(behaviour, openState), block)
|
||||
withIdlingResource(BottomSheetResource(behaviour, exitState)) {}
|
||||
}
|
||||
|
||||
class BottomSheetResource(
|
||||
|
|
Loading…
Reference in a new issue