У нас есть страница, которая в некотором смысле действует как электронная почта. Итак, у нас есть Recyclerview с кучей TextViews, один из которых - большой TextView, содержащий все содержимое электронной почты.Неоднозначные результаты Эспрессо на довольно базовом испытании
Итак, мы просто пытаемся проверить, что весь текст электронной почты загружен и отображен (мы добавляем специальную строку в конце, и мы собираемся проверить, что она появляется).
Espresso.onView(Matchers.allOf(ViewMatchers.isDisplayed(), ViewMatchers.withId(R.id.email_content)))
.perform(ViewActions.scrollTo(), ViewActions.swipeUp());
Когда побежал мы получаем эту ошибку:
Caused by: android.support.test.espresso.PerformException: Error performing 'click (after 3 attempts)' on view 'unknown'.
at android.support.test.espresso.PerformException$Builder.build(PerformException.java:83)
at android.support.test.espresso.action.MotionEvents.sendDown(MotionEvents.java:111)
at android.support.test.espresso.action.Swipe.sendLinearSwipe(Swipe.java:88)
at android.support.test.espresso.action.Swipe.access$100(Swipe.java:31)
at android.support.test.espresso.action.Swipe$1.sendSwipe(Swipe.java:38)
at android.support.test.espresso.action.GeneralSwipeAction.perform(GeneralSwipeAction.java:70)
Так что, когда мы изменить его к этому:
Espresso.onView(Matchers.allOf(ViewMatchers.isDisplayed(), ViewMatchers.withId(R.id.email_content)))
.perform(ViewActions.swipeUp());
Мы получаем эту ошибку:
Caused by: java.lang.RuntimeException: Action will not be performed because the target view does not match one or more of the following constraints:
at least 90 percent of the view's area is displayed to the user.
Target view: "AppCompatTextView{id=2131558822, res-name=email_content, visibility=VISIBLE, width=1048, height=1513896, 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=16.0, y=175.0, text=
Почему в первом случае он говорит, что не мог прокрутить vi ew, а во втором случае он говорит, что он недостаточно хорошо виден?