Espresso throw"执行单击'时出错在视图“当它在云中的设备上运行,但同一测试成功在本地运行

时间:2017-10-12 17:35:18

标签: firebase android-espresso

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

日志:

  

10-03 07:36:30.308:D / _IdlingResource(27742):_现在是空闲的!用:0   10-03 07:36:30.308:D / _IdlingResource(27742):_现在正在闲置!用:0   10-03 07:36:30.318:I / ViewInteraction(27742):执行'替换   文'对视图的操作,使用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:com ._:id / password 10-03 07:36:30.388:   D / _IdlingResource(27742):_现在空闲!与:0 10-03 07:36:30.388:   D / _IdlingResource(27742):_现在空闲!用:0    10-03 07:36:30.388:I / ViewInteraction(27742):执行单击'对视图的操作,使用id:com ._:id / Button 10-03 07:36:30.398:   I / InputDispatcher(3416):向(3959)发送触摸:动作:0x4,   toolType:0 10-03 07:36:30.398:I / InputDispatcher(3416):正在交付   touch to(27742):action:0x0,toolType:0 10-03 07:36:30.398:   D / ViewRootImpl(27742):ViewPostImeInputStage ACTION_DOWN 10-03   07:36:30.408:D / _IdlingResource(27742):_现在空闲!用:0 10-03   07:36:30.408:D / _IdlingResource(27742):_现在空闲!用:0 10-03   07:36:30.428:D / _IdlingResource(27742):_现在是空闲的!用:0 10-03   07:36:30.428:D / _IdlingResource(27742):_现在是空闲的!用:0 10-03   07:36:30.438:D / _IdlingResource(27742):_现在是空闲的!用:0 10-03   07:36:30.438:D / _IdlingResource(27742):_现在是空闲的!用:0 10-03   07:36:30.448:D / _IdlingResource(27742):_现在是空闲的!用:0 10-03   07:36:30.448:D / _IdlingResource(27742):_现在是空闲的!用:0 10-03   07:36:30.458:D / _IdlingResource(27742):_现在是空闲的!用:0 10-03   07:36:30.458:D / _IdlingResource(27742):_现在是空闲的!用:0 10-03   07:36:30.458:D / _IdlingResource(27742):_现在是空闲的!用:0 10-03   07:36:30.458:D / _IdlingResource(27742):_现在是空闲的!用:0 10-03   07:36:30.478:D / _IdlingResource(27742):_现在是空闲的!用:0 10-03   07:36:30.478:D / _IdlingResource(27742):_现在是空闲的!用:0 10-03   07:36:30.488:I / InputDispatcher(3416):向(27742)发送触摸:   action:0x1,toolType:0 10-03 07:36:30.498:D / Request(27742):方法:   1网址:https://。

******我删除了网络电话**********

  

10-03 07:37:30.538:I / TestRunner(27742):   android.support.test.espresso.PerformException:执行错误   '单击 - 在坐标:719,1367和精度:16,16'上   查看' ID:com。:id / Button'。 10-03 07:37:30.538:   I / TestRunner(27742):at   android.support.test.espresso.PerformException $ Builder.build(PerformException.java:83)   10-03 07:37:30.538:I / TestRunner(27742):at   android.support.test.espresso.base.DefaultFailureHandler.getUserFriendlyError(DefaultFailureHandler.java:80)   10-03 07:37:30.538:I / TestRunner(27742):at   android.support.test.espresso.base.DefaultFailureHandler.handle(DefaultFailureHandler.java:56)   10-03 07:37:30.538:I / TestRunner(27742):at   android.support.test.espresso.ViewInteraction.runSynchronouslyOnUiThread(ViewInteraction.java:184)   10-03 07:37:30.538:I / TestRunner(27742):at   android.support.test.espresso.ViewInteraction.doPerform(ViewInteraction.java:115)   10-03 07:37:30.538:I / TestRunner(27742):at   android.support.test.espresso.ViewInteraction.perform(ViewInteraction.java:87)   10-03 07:37:30.538:I / TestRunner(27742):at   页 ._ LinkAccountPage.clickOnLinkAccountButton( LinkAccountPage.java:62)   10-03 07:37:30.538:I / TestRunner(27742):at   页面 ._ LinkAccountPage.linkAccount( LinkAccountPage.java:40)10-03   07:37:30.538:I / TestRunner(27742):at   JunitTest .Test_BaseEspresso.searchAndLinkBill(Test_BaseEspresso.java:138)   10-03 07:37:30.538:I / TestRunner(27742):at   JunitTest_.Test_LinkFiCreditKycPayCurrentBalanceNewAchReceiptCancel.Test_LinkFiCreditKycPayCurrentBalanceNewAchReceiptCancel(Test_LinkFiCreditKycPayCurrentBalanceNewAchReceiptCancel.java:41)   10-03 07:37:30.538:I / TestRunner(27742):at   java.lang.reflect.Method.invoke(Native Method)10-03 07:37:30.538:   I / TestRunner(27742):at   java.lang.reflect.Method.invoke(Method.java:372)10-03 07:37:30.538:   I / TestRunner(27742):at   org.junit.runners.model.FrameworkMethod $ 1.runReflectiveCall(FrameworkMethod.java:50)   10-03 07:37:30.538:I / TestRunner(27742):at   org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)   10-03 07:37:30.538:I / TestRunner(27742):at   org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)   10-03 07:37:30.538:I / TestRunner(27742):at   org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)   10-03 07:37:30.538:I / TestRunner(27742):at   org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)   10-03 07:37:30.538:I / TestRunner(27742):at   org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)   10-03 07:37:30.538:I / TestRunner(27742):at   android.support.test.internal.statement.UiThreadStatement.evaluate(UiThreadStatement.java:55)   10-03 07:37:30.538:I / TestRunner(27742):at   android.support.test.rule.ActivityTestRule $ ActivityStatement.evaluate(ActivityTestRule.java:270)   10-03 07:37:30.538:I / TestRunner(27742):at   org.junit.rules.RunRules.evaluate(RunRules.java:20)10-03   07:37:30.538:I / TestRunner(27742):at   org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)10-03   07:37:30.538:I / TestRunner(27742):at   org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)   10-03 07:37:30.538:I / TestRunner(27742):at   org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)   10-03 07:37:30.538:I / TestRunner(27742):at   org.junit.runners.ParentRunner $ 3.run(ParentRunner.java:290)10-03   07:37:30.538:I / TestRunner(27742):at   org.junit.runners.ParentRunner $ 1.schedule(ParentRunner.java:71)10-03   07:37:30.538:I / TestRunner(27742):at   org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)   10-03 07:37:30.538:I / TestRunner(27742):at   org.junit.runners.ParentRunner.access $ 000(ParentRunner.java:58)10-03   07:37:30.538:I / TestRunner(27742):at   org.junit.runners.ParentRunner $ 2.evaluate(ParentRunner.java:268)10-03   07:37:30.538:I / TestRunner(27742):at   org.junit.runners.ParentRunner.run(ParentRunner.java:363)10-03   07:37:30.538:I / TestRunner(27742):at   org.junit.runners.Suite.runChild(Suite.java:128)10-03 07:37:30.538:   I / TestRunner(27742):at   org.junit.runners.Suite.runChild(Suite.java:27)10-03 07:37:30.538:   I / TestRunner(27742):at   org.junit.runners.ParentRunner $ 3.run(ParentRunner.java:290)10-03   07:37:30.538:I / TestRunner(27742):at   org.junit.runners.ParentRunner $ 1.schedule(ParentRunner.java:71)10-03   07:37:30.538:I / TestRunner(27742):at   org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)   10-03 07:37:30.538:I / TestRunner(27742):at   org.junit.runners.ParentRunner.access $ 000(ParentRunner.java:58)10-03   07:37:30.538:I / TestRunner(27742):at   org.junit.runners.ParentRunner $ 2.evaluate(ParentRunner.java:268)10-03   07:37:30.538:I / TestRunner(27742):at   org.junit.runners.ParentRunner.run(ParentRunner.java:363)10-03   07:37:30.538:I / TestRunner(27742):at   org.junit.runner.JUnitCore.run(JUnitCore.java:137)10-03 07:37:30.538:   I / TestRunner(27742):at   或者是.unit.Runner。   I / TestRunner(27742):at   android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:59)   10-03 07:37:30.538:I / TestRunner(27742):at   android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:262)   10-03 07:37:30.538:I / TestRunner(27742):at   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):at   android.support.test.espresso.IdlingPolicy.handleTimeout(IdlingPolicy.java:61)   10-03 07:37:30.538:I / TestRunner(27742):at   android.support.test.espresso.base.UiControllerImpl.loopUntil(UiControllerImpl.java:480)   10-03 07:37:30.538:I / TestRunner(27742):at   android.support.test.espresso.base.UiControllerImpl.loopUntil(UiControllerImpl.java:411)   10-03 07:37:30.538:I / TestRunner(27742):at   android.support.test.espresso.base.UiControllerImpl.injectMo 10-03   07:37:30.538:I / TestRunner(27742):-----结束异常----- 10-03   07:37:30.538:I / TestRunner(27742):完成:   Test_LinkFiCreditKycPayCurrentBalanceNewAchReceiptCancel(JunitTest_.Test_LinkFiCreditKycPayCurrentBalanceNewAchReceiptCancel)   10-03 07:37:30.578:I / MonitoringInstrumentation(27742):活动   仍然在创建停止:3 10-03 07:37:30.578:   I / MonitoringInstrumentation(27742):完成活动:   com。 .core.provider.AddProviderActivity @ 3f31fd61 10-03 07:37:30.578:   V / ApplicationPolicy(3416):isApplicationStateBlocked userId 0 pkgname   com。 10-03 07:37:30.578:V / ApplicationPolicy(3416):   isApplicationStateBlocked userId 0 pkgname com._ 10-03 07:37:30.578:   D / InputDispatcher(3416):聚焦应用程序设置为:xxxx 10-03   07:37:30.588:I / ActivityManager(3416):跳过updateThumbnail for   r = ActivityRecord {23d1bfe2 u0 com。 /.core.provider.AddProviderActivity   t5 f} 10-03 07:37:30.588:I / MonitoringInstrumentation(27742):   整理活动:   com。 .core.overview.NewUserSignUpIntroScreen @ 18c65aea 10-03   07:37:30.598:I / MonitoringInstrumentation(27742):完成活动:   com。 .core.provider.SearchProviderActivity @ 33d373f6 10-03   07:37:30.598:V / ApplicationPolicy(3416):isApplicationStateBlocked   userId 0 pkgname com。 10-03 07:37:30.598:V / ApplicationPolicy(3416):   isApplicationStateBlocked userId 0 pkgname   com.google.android.apps.mtaas.backdrop 10-03 07:37:30.598:   D / InputDispatcher(3416):聚焦应用程序设置为:xxxx 10-03   07:37:30.598:D / MultiWindowConverter(3416):dismissGuide():之前   附加指南视图,mForceDismissGuide:false 10-03   07:37:30.598:D / InputDispatcher(3416):焦点左侧窗口:27742 10-03   07:37:30.598:I / TestRunner(27742):运行完成:1次测试,1次失败,0   忽略10-03 07:37:30.608:I / System.out(27742):( HTTPLog)-Static:   isSBSettingEnabled false 10-03 07:37:30.608:D / PointerIcon(3416):   setMouseIconStyle1 pointerType:1001 iconType:101标志:0 pid:3416   uid:1000 10-03 07:37:30.608:D / PointerIcon(3416):setMouseCustomIcon   IconType相同.101 10-03 07:37:30.608:D / EnterpriseController(2962):   mIsMarkChainAdded为0 mIsBlockChainAdded为0 netId为0 10-03   07:37:30.608:D / Netd(2962):getNetworkForDns:使用netid 502 for uid   10207 10-03 07:37:30.608:D / Lifecycle(27742):onActivityPaused:   core.provider.AddProviderActivity

1 个答案:

答案 0 :(得分:0)

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

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

一个例子:

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()));