mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-02-06 22:13:31 +01:00
adding expected open/closed state to the bottom sheet waiting
This commit is contained in:
parent
69745ea74e
commit
97d768e392
@ -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…
x
Reference in New Issue
Block a user