有没有一种方式可以使用Espresso测试Snackbar是否以正确的文本显示出来?
我有一个简单的调用来创建Snackbar。
Snackbar.make(mView, "My text", Snackbar.LENGTH_LONG).show();
我尝试过但没有成功
onView(withText("My text")).inRoot(withDecorView(not(is(mActivityRule.getActivity().getWindow().getDecorView())))).check(matches(isDisplayed()));
Y
位置为0.0
时进行检查时,您该怎么做?isDisplayed
会抛出异常。 - Christopher FranciscoNoMatchingViewException: No views in hierarchy found matching: with id: com.my.package.debug:id/snackbar_text
。有什么想法吗? - Chisko