我有一个关于Android Espresso测试的问题。
本地测试通过但在FTL上失败了。这是一个简单的测试。
有人能帮忙解决这个问题吗?
onView(allOf(withId(R.id.text_supercategory_name), withText("Air conditioners"))).
check(matches(withText("Air conditioners")));
这个测试本地测试通过,但在FTL上我看到以下错误:
android.support.test.espresso.NoMatchingViewException: No views in hierarchy found matching: (with id: blablabla:id/text_product_verdict and with text: is "Air conditioners")
我不明白为什么会出现没有在我的测试中使用的ID id/text_product_verdict
…而且这个ID来自另一个活动…
测试用的活动是正确的。
@Rule
public ActivityTestRule<HomeActivity> mActivityTestRule = new ActivityTestRule<>(HomeActivity.class);
我检查了在FTL上失败的测试视频,并看到模拟器上有很多通知消息。
来自FTL的图片
我决定问题可能是来自Google Hangouts的粘性通知,尝试使用--no-auto-google-login
标志运行测试。但结果相同。使用onView(withText("Air conditioners")).check(matches(isDisplayed()));
测试可以在FTL上通过。有人能帮忙解决这个问题吗?