I'm writing tests for my Android App with the Espresso framework. This seems to work fine so far. Problem is that I sometimes have to change the Activity.
In this specific case clicking a button opens the Google PlacePicker for selecting a certain position. But meanwhile this Activity is shown, Espresso is waiting for the next step. So instead of interacting in this Activity it stalls until I manually close the Place Picker (or the timeout is reached).
So it looks like this:
onView(withId(R.id.origin)).perform(click()); // opens PlacePicker
onView(...) // is only executed the moment I manually close the PlacePicker
Espresso works with only one activity. It is designed to test activities.
You can simulate PlacePicker call by manually calling your onActivityResult
with some fake (manually created) Intent.
So call
onActivityResult(PLACE_PICKER_REQUEST, RESULT_OK, intent)
instead of
onView(withId(R.id.origin)).perform(click()); // opens PlacePicker