title: How to click on Android Gallery with Espresso
body: <p>We currently have an Android application that we are testing with Espresso. One of the features we want to test is selecting a picture/image from the local image gallery. We can get all the way to bringing up the Gallery view, but then cannot select from Recent, Downloads, Gallery in the resulting window. A snippet as to how we got as far as we did is included below.</p>
  
  <pre><code>public void testShouldBeAbleToSelectPhotoFromGallery() {
  
      getActivity();
  
      // given
      onView(withId(launch_gallery_button)).perform(click());
      onView(withText("Gallery")).perform(click());  // this is a button in our app
      // then we get stuck :(
  }
  </code></pre>
  
  <p>Thanks!</p>