I have seen some questions about it.
eg. Android Espresso testing app flow
But the anwser above is not working in espresso 2. Here is my snippet
@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()));
}
If Multi-Activities Test is not allow in one TestFile, then how to make a flow to test multiple activities?