title: How to write tests for deep links in Android?
body: <p>I would like to write tests for <a href="https://developer.android.com/training/app-indexing/deep-linking.html" rel="noreferrer">Android app with deep link cases</a> using UI testing framework (Espresso) - launch app using only ACTION_VIEW intent and check all views on opened screen. </p>
  
  <p>But looks like Espresso (even espresso-intents) doesn't have this functionality, and require to define Activity class.</p>
  
  <p>I tried this way, but it doesn't work properly, because launched app twice - standard launch using AppLauncherActivity (required by Espresso) and launch via deep link.</p>
  
  <pre><code>@RunWith(AndroidJUnit4.class)
  public class DeeplinkAppLauncherTest {
  
      @Rule
      public ActivityTestRule&lt;AppLauncherActivity&gt; activityRule = new ActivityTestRule&lt;&gt;(AppLauncherActivity.class);
  
      @Test
      public void testDeeplinkAfterScollDownAndBackUp() {
          Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("myapp://search/777"));
          activityRule.launchActivity(intent);
  
          onView(withId(R.id.search_panel)).check(matches(isDisplayed()));
      }
  
  }
  </code></pre>
  
  <p>I would like to launch testing app using only deep link without standard launch.
  Do you know, how to do it?</p>