草庐IT

espresso

全部标签

android - Espresso - 单击对话框的按钮

我想测试一下Android6的权限,但是没有找到使用Espresso点击“允许”按钮的方法。有办法做到这一点吗?Espresso的版本是2.2.1。测试:@TestpublicvoidacceptFirstPermission()throwsException{onView(withText("ALLOW")).perform(click());}行为:IstillreceivingthefrozenscreenwiththeDialog(likeonthescreenshot).Testexecutingalltimeuntilhebecomesfinished.输出:Running

android - 在对话框中选择微调器时 Android Espresso 中的 RunTimeException

我有一个Activity,其中一些对话是开放式的。在此对话框中有一个微调器。我想在此微调器中选择一个特定值,但出现以下异常:java.lang.RuntimeException:Waitedfortherootoftheviewhierarchytohavewindowfocusandnotberequestinglayoutforover10seconds.Ifyouspecifiedanondefaultrootmatcher,itmaybepickingarootthatnevertakesfocus.Otherwise,somethingisseriouslywrong.Sel

android - 谷歌 Espresso java.lang.RuntimeException : Could not launch intent Intent { act=android. intent.action.MAIN

我是EspressoUI测试的新手。我在运行测试时遇到这个错误(ADTEclipseIDE)。该应用程序已经开发完成,并且在启动该应用程序时有很多请求正在进行。无法重写应用程序。但我需要找到测试此UI的方法,即使组件加载有任何延迟也是如此。java.lang.RuntimeException:CouldnotlaunchintentIntent{act=android.intent.action.MAINflg=0x14000000cmp=com.xx.android/com.yy.core.android.map.MapActivity}within45seconds.Perhaps

android - onChildView 和 hasSiblings 与 Espresso

我正在尝试从特定View访问按钮。同一View显示6次。这是我正在使用的代码。publicvoidtestTimeConfig(){onData(withDesc("description")).onChildView(withId(R.id.positive)).perform(click());}privatestaticMatcherwithDesc(Stringdesc){returnallOf(is(instanceOf(String.class)),is(desc));}当我运行时,出现错误:Errorperforming'loadadapterdata'onview'is

android espresso 测试 : empty test suite. 未找到测试

我在Windows上运行intelliJidea14.0.2android开发环境,并尝试使用espressoUI测试框架来测试我的应用程序。但是,当我按run进行androidTest配置时,我遇到以下问题:Testingstartedat12:09PM...Waitingfordevice.Targetdevice:lge-nexus_5-05b1bd8af0ddba12Uploadingfilelocalpath:C:\Users\AsiAnSeNsAtIoN\Documents\note\ECSE428\AssB_2\build\classes\main\AssB_2.apkr

android - 在多项 Activity 中使用 Espresso 空闲资源

我有一个启动secondActivity的firstActivity,在secondActivity中我有一个加载对话框(不是AsyncTask),我需要让Espresso等到对话框消失,然后才能继续测试。我必须在哪里实现IdlingResource?如何让它等待dismissDialog()函数?这是我尝试做的:classDocumentLoadingIdlingResourceimplementsIdlingResource{privateResourceCallbackcallback;@OverridepublicStringgetName(){return"Documnetl

android - Espresso - typeText() 无法正常工作,有时会丢失字母

我开始登录Activity并在Espresso测试中使用:onView(withId(R.id.username)).perform(typeText("USERNAME"));我希望字段中的文本是“USERNAME”,但有时我得到的是“SERNAME”,其他的是“UERNAME”。大多数时候它可以工作,但有时会失败,特别是在重启手机之后。这里是重现错误的示例代码:https://github.com/neoranga55/CleanGUITestArchitecture 最佳答案 测试手机使用支持双语输入的Swift键盘。显然,这

android - Espresso 测试失败 : Wanted to match 1 intent, 实际上匹配了 2 个 Intent

我在使用Espresso测试Activity启动时遇到此错误。android.support.test.espresso.base.DefaultFailureHandler$AssertionFailedWithCauseError:想要匹配1个Intent。实际上匹配了2个Intent。令人惊讶的是,使用相同代码的其他Activity启动测试正在通过。@RunWith(AndroidJUnit4.class)publicclassHomeActivityTest{@RulepublicfinalIntentsTestRulemHomeActivityRule=newIntentsT

android - Espresso : Recyclerview scroll to end

有没有办法使用Espresso滚动到recyclerview的末尾?有一个带有文本的项目让我们说'TextXYZ'并且recyclerview有一个idrecycler_view。此项恰好是回收站View的最后一项。我试过了onView(withId(R.id.recycler_view)).check(matches(isDisplayed())).perform(RecyclerViewActions.scrollTo(withText("TextXYZ")),click());但这似乎行不通。有什么想法吗? 最佳答案 Recy

android - 如何在 Espresso 中实际启动 Activity 的情况下检查发送的预期 Intent ?

我有一个UI测试,它单击一个按钮,然后在其onClickListener中启动一个新的Activity。该测试检查是否发送了预期的Intent。我的问题是,我想测试是否发送了预期的Intent而没有实际启动Activity。因为我发现新的Activity会初始化它的状态,这会使后续测试不稳定。我知道有两个EspressoIntentsAPI,即intended和intending,但都不能满足我的需求。intendedAPI实际启动目标Activity,并且intendingAPI不会启动Activity,但会调用onActivityResult我也不想要的回调。因为恐怕里面的代码是o