Espresso 在云中的设备上运行时会抛出"在视图中执行'single click'时出错",但相同的测试在本地成功运行



我填写用户名和密码,然后按下通过网络发送信息的按钮(实现了Espresso Idling资源),在应用程序中会出现下一个屏幕,我可以在日志中看到信息已经发送。但测试失败,错误是无法按下按钮:android.support.test.espresso.PerformException:在id为的视图上执行"单击"时出错

日志:

10-03 07:36:30.308:D/_IdlingResource(27742):_现在空闲!使用:010-03 07:36:30.308:D/_IdlingResource(27742):_现在空闲!使用:010-03 07:36:30.318:I/ViewInteraction(27742):执行"替换"text'与id.com._:id/user_name一起查看操作10-03 07:36:30.358:D/_IdlingResource(27742):_现在空闲!与:0 10-03 07:36:30.358:D/_IdlingResource(27742):_现在空闲!与:0 10-03 07:36:30.358:I/ViewInteraction(27742):对视图执行"替换文本"操作id:id/密码10-03 07:36:30.388:D/_IdlingResource(27742):_现在空闲!与:0 10-03 07:36:30.388:D/_IdlingResource(27742):_现在空闲!使用:010-03 07:36:30.388:I/ViewInteraction(27742):使用id.com_:id/Button在视图上执行"单击"操作10-03-03:6:30.398:I/InputDispatcher(3416):将触摸传递到(3959):操作:0x4,工具类型:0 10-03 07:36:30.398:I/InputDispatcher(3416):交付触摸到(27742):动作:0x0,工具类型:0 10-03 07:36:30.398:D/ViewRootImpl(27742):ViewPostImeInputStage ACTION_DOWN 10-0307:36:30.408:D/_IdlingResource(27742):_现在空闲!与:0 10-0307:36:30.408:D/_IdlingResource(27742):_现在空闲!与:0 10-0307:36:30.428:D/_IdlingResource(27742):_现在空闲!与:0 10-0307:36:30.428:D/_IdlingResource(27742):_现在空闲!与:0 10-0307:36:30.438:D/_IdlingResource(27742):_现在空闲!与:0 10-0307:36:30.438:D/_IdlingResource(27742):_现在空闲!与:0 10-0307:36:30.448:D/_IdlingResource(27742):_现在空闲!与:0 10-0307:36:30.448:D/_IdlingResource(27742):_现在空闲!与:0 10-0307:36:30.458:D/_IdlingResource(27742):_现在空闲!与:0 10-0307:36:30.458:D/_IdlingResource(27742):_现在空闲!与:0 10-0307:36:30.458:D/_IdlingResource(27742):_现在空闲!与:0 10-0307:36:30.458:D/_IdlingResource(27742):_现在空闲!与:0 10-0307:36:30.478:D/_IdlingResource(27742):_现在空闲!与:0 10-0307:36:30.478:D/_IdlingResource(27742):_现在空闲!与:0 10-0307:36:30.488:I/InputDispatcher(3416):将触摸传递到(27742):操作:0x1,工具类型:0 10-03 07:36:30.498:D/请求(27742):方法:1网址:https://。

******我删除了网络调用**********

10-03 07:37:30.538:I/TestRunner(27742):android.support.test.espresso.PerformException:执行时出错'单击-坐标:7191367,精度:1616'打开视图'with-id:com.:id/Button'。10-03 07:37:30.538:I/TestRunner(27742):位于android.support.test.sespresse.PerformException$Builder.build(PerformException.java:83)10-03 07:37:30.538:I/TestRunner(27742):在android.support.test.sespresse.base.DefaultFailureHandler.getUserFriendlyError(DefaultFailureHandler.java:80)10-03 07:37:30.538:I/TestRunner(27742):在android.support.test.sespresso.base.DefaultFailureHandler.handle(DefaultFailureHandler.java:56)10-03 07:37:30.538:I/TestRunner(27742):在android.support.test.sespresse.ViewInteraction.runSynchronouslyOnUiThread(ViewInteraction.java:184)10-03 07:37:30.538:I/TestRunner(27742):在android.support.test.sespresso.ViewInteraction.doPerform(ViewInteraction.java:115)10-03 07:37:30.538:I/TestRunner(27742):在android.support.test.sespresse.ViewInteraction.perform(ViewInteraction.java:87)10-03 07:37:30.538:I/TestRunner(27742):在页码_LinkAccountPage.点击OnLinkAccountButton(LinkAccountPage.java:62)10-03 07:37:30.538:I/TestRunner(27742):在页码_LinkAccountPage.linkAccount(LinkAccountPage.java:40)10-0307:37:30.538:I/TestRunner(27742):在JunitTest.Test_BaseEspresso.searchAndLinkBill(Test_BaseEsresso.java:138)10-03 07:37:30.538:I/TestRunner(27742):在JunitTest_.Test_LinkFiCreditKycPayCurrentBalanceNewAchReceiptCancel.Test_Link FiCreditKyc PayCurrentBalance NewAchRECeiptCancel10-03 07:37:30.538:I/TestRunner(27742):在java.lang.reflect.Method.ioke(本机方法)10-03 07:37:30.538:I/TestRunner(27742):位于java.lang.reflect.Method.ioke(Method.java:372)10-03 07:37:30.538:I/TestRunner(27742):位于org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)10-03 07:37:30.538:I/TestRunner(27742):在org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)10-03 07:37:30.538:I/TestRunner(27742):在org.junit.runners.model.FrameworkMethod.invokeExploly(FrameworkMethod.java:47)10-03 07:37:30.538:I/TestRunner(27742):在org.junit.internal.runners.statements.InvokeMethod.eevaluate(InvokeMethod.java:17)10-03 07:37:30.538:I/TestRunner(27742):在org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)10-03 07:37:30.538:I/TestRunner(27742):在org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)10-03 07:37:30.538:I/TestRunner(27742):在android.support.test.internal.statement.UiThreadStatement.eevaluate(UiThreadStatements.java:55)10-03 07:37:30.538:I/TestRunner(27742):在android.support.test.rule.ActivityTestRule$ActivityStatement.eevaluate(ActivityTestRule.java:270)10-03 07:37:30.538:I/TestRunner(27742):在org.junit.rules.RunRules.evaluate(RunRules.java:20)10-0307:37:30.538:I/TestRunner(27742):在org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)10-0307:37:30.538:I/TestRunner(27742):在org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)10-03 07:37:30.538:I/TestRunner(27742):在org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)10-03 07:37:30.538:I/TestRunner(27742):在org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)10-0307:37:30.538:I/TestRunner(27742):在org.junit.runners.ParentRunner$1.时间表(ParentRunner.java:71)10-0307:37:30.538:I/TestRunner(27742):在org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)10-03 07:37:30.538:I/TestRunner(27742):在org.junit.runners.ParentRunner.access$000(ParentRunner:58)10-0307:37:30.538:I/TestRunner(27742):在org.junit.runners.ParentRunner$2.eevaluate(ParentRunner.java:268)10-0307:37:30.538:I/TestRunner(27742):在org.junit.runners.ParentRunner.run(ParentRunner:363)10-0307:37:30.538:I/TestRunner(27742):在org.junit.runners.Suite.runChild(Suite.java:128)10-03 07:37:30.538:I/TestRunner(27742):位于org.junit.runners.Suite.runChild(Suite.java:27)10-03 07:37:30.538:I/TestRunner(27742):位于org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)10-0307:37:30.538:I/TestRunner(27742):在org.junit.runners.ParentRunner$1.时间表(ParentRunner.java:71)10-0307:37:30.538:I/TestRunner(27742):在org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)10-03 07:37:30.538:I/TestRunner(27742):在org.junit.runners.ParentRunner.access$000(ParentRunner:58)10-0307:37:30.538:I/TestRunner(27742):在org.junit.runners.ParentRunner$2.eevaluate(ParentRunner.java:268)10-0307:37:30.538:I/TestRunner(27742):在org.junit.runners.ParentRunner.run(ParentRunner:363)10-0307:37:30.538:I/TestRunner(27742):在org.junit.runner.JUnitCore.run(JUnitCores.java:137)10-03 07:37:30.538:I/TestRunner(27742):位于org.junit.runner.JUnitCore.run(JUnitCores.java:115)10-03 07:37:30.538:I/TestRunner(27742):位于android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:59)10-03 07:37:30.538:I/TestRunner(27742):在android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRuner.java:262)10-03 07:37:30.538:I/TestRunner(27742):在android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1889)**************注意以下错误**10-03 07:37:30.538:I/TestRunner(27742):由以下原因引起:android.support.test.espresso.AppNotIdleException:在60秒内循环3585次迭代。以下怠速条件失败10-03 07:37:30.538:I/TestRunner(27742):在android.support.test.sespresso.IdlingPolicy.handleTimeout(IdlingPolicy.java:61)10-03 07:37:30.538:I/TestRunner(27742):在android.support.test.sespresso.base.UiControllerImpl.loopUntil(UiController Impl.java:480)10-03 07:37:30.538:I/TestRunner(27742):在android.support.test.sespress.base.UiControllerImpl.loopUntil(UiController Impl.java:411)10-03 07:37:30.538:I/TestRunner(27742):在android.support.test.espresso.base.UiControllerImpl.injectMo 10-0307:37:30.538:I/TestRunner(27742):-----结束异常-----10-0307:37:30.538:I/TestRunner(27742):已完成:Test_LinkFiCreditKycPayCurrentBalanceNewAchReceiptCancel10-03 07:37:30.578:I/MonitoringInstrumentation(27742):活动仍处于创建到停止状态:3 10-03 07:37:30.578:I/MonitoringInstrumentation(27742):完成活动:.core.provider.AddProviderActivity@3f31fd6110-03 07:37:30.578:V/ApplicationPolicy(3416):isApplicationStateBlocked userId 0 pkgname10-03 07:37:30.578:V/ApplicationPolicy(3416):isApplicationStateBlocked userId 0 pkgname com._ 10-03 07:37:30.578:D/InputDispatcher(3416):重点应用程序设置为:xxxx 10-0307:37:30.588:I/ActivityManager(3416):跳过的更新缩略图r=活动记录{23d1bfe2 u0 com./.core.provider.AddProviderActivityt5 f}10-03 07:37:30.588:I/MonitoringInstrumentation(27742):整理活动:com.core.overview.NewUserSignUpIntroScreen@18c65aea2003年10月07:37:30.598:I/MonitoringInstrumentation(27742):完成活动:.core.provider.SearchProviderActivity@33d373f62003年10月07:37:30.598:V/ApplicationPolicy(3416):isApplicationStateBlockeduserId 0 pkgname com.10-03 07:37:30.598:V/ApplicationPolicy(3416):isApplicationStateBlocked用户ID 0 pkgnamecom.google.android.apps.mtaas.backdrop 10-03 07:37:30.598:D/InputDispatcher(3416):重点应用程序设置为:xxxx 10-0307:37:30.598:D/MultiWindowConverter(3416):解除指南():之前附加引导视图,mForceDisissGuide:false 10-0307:37:30.598:D/InputDispatcher(3416):聚焦左窗口:27742 10-0307:37:30.598:I/TestRunner(27742):运行已完成:1个测试,1个失败,0忽略10-03 07:37:30.608:I/System.out(27742):(HTTPLog)-静态:isSBSettingEnabled false 10-03 07:37:30.608:D/PointerIcon(3416):setMouseIconStyle1指针类型:1001图标类型:101标志:0 pid:3416uid:1000 10-03 07:37:30.608:D/PointerIcon(3416):setMouseCustomIconIcoType相同。101 10-03 07:37:30.608:D/EnterpriseController(2962):mIsMarkChainAdded为0 mIsBlockChainAddd为0 netId为0 10-0307:37:30.608:D/Netd(2962):getNetworkForDns:使用netid 502作为uid10207 10-03 07:37:30.608:D/生命周期(27742):活动暂停:core.provider.AddProviderActivity

通常,当您在字段隐藏在软键盘后面的屏幕上工作时,会出现这种错误。因此,您应该做几件事:

  1. 使布局可滚动,并使用ViewActions.scrollTo执行滚动到该字段
  2. 使用ViewActions.closeSoftKeyboard关闭que软键盘

一个例子:

String OLD_PWD_INPUT = "Asdf1234;";
onView(withId(R.id.old_password)).perform(typeText(OLD_PWD_INPUT));
onView(withId(R.id.verify_new_password)).perform(closeSoftKeyboard());
onView(withId(R.id.change_password_button)).check(matches(not(isEnabled())));
String NEW_PWD_INPUT = "Asdf1235;";
onView(withId(R.id.new_password)).perform(scrollTo());
onView(withId(R.id.new_password)).perform(typeText(NEW_PWD_INPUT));
onView(withId(R.id.verify_new_password)).perform(closeSoftKeyboard());
onView(withId(R.id.change_password_button)).check(matches(isEnabled()));

最新更新