Gor*_*ets 6 android android-espresso
我试图用'espresso'编写简单的测试
@RunWith(AndroidJUnit4.class)
@LargeTest
public class EspressoTest {
@Rule
public ActivityRule<IntroActivity> mActivityRule = new ActivityRule(IntroActivity.class);
public EspressoTest() {
IdlingPolicies.setMasterPolicyTimeout(1000, TimeUnit.SECONDS);
}
@Test
public void testShouldClickEmailButton() {
onView(withText(R.string.in_email)).perform(click());
}
}
Run Code Online (Sandbox Code Playgroud)
但我得到一个错误:
PerformException: Error performing 'single click' on view 'with string from resource id: <2131099761>[in.email] value: Login With Email'.
Run Code Online (Sandbox Code Playgroud)
我正在尝试不同的测试框架,robotium目前为止对我来说是最好的,但是如果有人可以解决此错误,我将不胜感激
UPD更详细的日志
由以下原因引起:java.lang.RuntimeException:由于目标视图与以下一个或多个约束不匹配,因此不会执行操作:向用户显示视图区域的至少90%。目标视图:“ DSeparatedButton {id = 2131427459,res-name = button_login,可见性= VISIBLE,宽度= 622,高度= 120,has-focus = false,has-focusable = true,has-window-focus = true,is- clickable = true,is-enabled = true,is-focused = false,is-focusable = true,is-layout-requested = false,is-selected = false,root-is-layout-requested = false,has-input- connection = false,x = 0.0,y = 333.0,text =使用电子邮件登录,input-type = 0,ime-target = false,has-links = false}“
我也有一点飞溅动画

小智 -3
@RunWith(AndroidJUnit4.class)
@LargeTest
public class EspressoTest {
@Rule
public ActivityTestRule<IntroActivity> mActivityRule = new ActivityTestRule(IntroActivity.class);
@Test
public void testShouldClickEmailButton() {
mActivityRule.launch(new Intent());
onView(withText(R.string.in_email)).perform(click());
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7982 次 |
| 最近记录: |