我需要做这样的比较:
do{
onView(withText("Some Text 1")).perform(swipeUp());
}while (onView(withText("Some Text 2")).check(matches(isCompletelyDisplayed())) == false);
但是这个函数不返回布尔值,我怎样才能比较它来制作swipeUp()
?
修改
我用这个:
do {
try {
onView(withText("Some text 1")).check(matches((isCompletelyDisplayed())));
control = 0;
} catch (NoMatchingViewException e) {
onView(withText("Some text 2")).perform(swipeUp());
control = 1;
}
}while (control == 1);
现在的错误是:
android.support.test.espresso.base.DefaultFailureHandler $ AssertionFailedWithCauseError:'向用户显示至少100%的视图区域。'与所选视图不匹配。
预期:至少100%的视图区域会显示给用户。
得到:“AppCompatTextView {id = 16908310,res-name = title,visibility = VISIBLE,width = 667,height = 86,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 = 0.0,y = 64.0,text =检查app权限,input-type = 0,ime-target = false,has-links = false}“