I can not understand how to test several Activity once in one test.

For example:

 public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActivity>{ public MainActivityTest() { super(MainActivity.class); } @Override protected void setUp() throws Exception{ super.setUp(); getActivity(); } public void testTC_1_1(){ onView(withId(R.id.createE)).perform(click()); onView(withId(R.id.eventTitle)).perform(typeText("Test"), closeSoftKeyboard()); } } 

So on line

 onView(withId(R.id.createE)).perform(click()); 

The item under test is located on the MainActivity . And on line

 onView(withId(R.id.createE)).perform(typeText("Test"), closeSoftKeyboard()); 

In a completely different activation and as a result, an error occurs on this line:

android.support.test.espresso.NoMatchingViewException: No views in hierarchy found matching: with id: com.metoo.android:id/eventTitle

How to solve this problem?

  • Does nobody know? - Genome

0