I am performing the below test to validate the text on screen , The text is present on the view but need to page scroll to see the text manually.
onView(withText("Launch")).check(ViewAssertions.matches(isDisplayed()));
onView(withText("January 2010")).check(ViewAssertions.matches(isDisplayed()));
Following error is coming, However the text is present on the view but need to page scroll to see the text manually.
android.support.test.espresso.base.DefaultFailureHandler$AssertionFailedWithCauseError: 'is displayed on the screen to the user' doesn't match the selected view. Expected: is displayed on the screen to the user Got: "TextView{id=2131361941, res-name=project_details_label_tv, visibility=VISIBLE, width=249, height=41, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=4.0, y=24.0, text=Status, input-type=0, ime-target=false, has-links=false}"
Just perform a
ViewActions.scrollTo()
before your assertion: