我有一个有多种选择的旋转器。单击任意选项后,将在活动中的FrameLayout中加载片段。使用Espresso,我选择并单击一个自旋器项,没有任何错误,但在此之后,视图层次结构只包含自旋器PopupViewContainer,而我无法在我的活动中选择任何视图。
我的测试代码如下:
onView(withId(R.id.pager)).perform(swipeLeft()).perform(swipeLeft());
onView(withId(R.id.fgs_cbx_scan_type)).perform(click());
onData(hasToString(startsWith(GreenScanType.ARRIVAL.getName()))).inAdapterView(withId(R.id.fgs_cbx_scan_type)).perform(click());
//So far so good with no errors. Then the following call fails
//because the view hierarchy does not contain the hierarchy
//of the activity anymore but just the popup of the spinner.
onView(withId(R.id.fgs_cbx_scan_type)).check(matches(withText(containsString(GreenScanType.ARRIVAL.getName()))));我错过了什么或者做错了什么吗?
发布于 2016-02-05 07:31:02
最后我也不得不打电话给
onView(withText(GreenScanType.ARRIVAL.getName())).perform(click());onData后
https://stackoverflow.com/questions/35198166
复制相似问题