我已经看到了一些问题。
但是上面的答案在espresso 2中不起作用。这是我的摘录
@Rule
public ActivityTestRule<SplashActivity> mActivityTestRule = new ActivityTestRule<>(SplashActivity.class);
@Test
public void splashActivityTest() {
onView(withId(R.id.splash_container)).perform(swipeLeft());
onView(withId(R.id.splash_container)).perform(swipeLeft());
// launch the main activity
ViewInteraction appCompatButton = onView(
allOf(withId(R.id.introduction_goto_btn), withText("goToMainActivity"), isDisplayed()));
appCompatButton.perform(click());
// the hierarchy can't find HomeBtn , it still hold the Splash's View, so the code below will fail
onView(withId(R.id.home_btn)).check(ViewAssertions.matches(isDisplayed()));
}
Run Code Online (Sandbox Code Playgroud)
如果在一个TestFile中不允许进行多活动测试,那么如何进行测试多个活动的流程?