-
Notifications
You must be signed in to change notification settings - Fork 101
Cannot scroll to view in NestedScrollView #116
Comments
Hello there! Can you provide more info? Stacktrace at least? |
Hi, sorry to have confused you. Updated code as below <?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<Space
android:layout_width="wrap_content"
android:layout_height="600dp"
android:textColor="@color/background_color" />
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BUTTON" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView> Screen val content: KView = KView { withId(R.id.content) }
val button: KButton = KButton { withId(R.id.button) }
val snackbar: KSnackbar = KSnackbar() Test @Test
fun testContentScreen() {
screen {
content {
isVisible()
}
button {
scrollTo()
click()
}
snackbar {
isDisplayed()
}
}
} An exception
|
I resolved by create custom action like class NestedScrollActions(private val original: ScrollToAction = ScrollToAction()) : ViewAction by original {
override fun getConstraints(): Matcher<View> = CoreMatchers.anyOf(
CoreMatchers.allOf(
withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE),
isDescendantOfA(isAssignableFrom(NestedScrollView::class.java)))
, original.constraints
)
} and use button {
act {
NestedScrollActions()
}
click()
} Anyway, I'm not sure this is good enough solution for make a PR. |
Maybe the problem was with how you matched your button. It is possible that you need to match your button as a child of nested scroll view in your screen class. Cheers! |
Steps to reproduce:
Define layout with NestedScrollView
And scroll to view by
scrollTo()
Observed Results:
The text was updated successfully, but these errors were encountered: