问题出现:
espresso是Android官方推荐的UI测试框架,非常强大,但是今天遇到一个问题:
onView()
无法指定一个直接利用WindowManager.add()的View,抛出一个找不到的异常:
android.support.test.espresso.NoMatchingViewException: No views in hierarchy found matching
网上大部分都说是利用:inRoot
onView(ViewMatchers.withId(R.id.text))
.inRoot(withDecorView(not(is(mActivity.getWindow().getDecorView()))))
.check(matches