3

I got to a project which uses Airbnb DeepLinkDispatch library. This part works fine, I'm able to run activities via URI + query params which parse fine too. But when I tried using Espresso I got this issue - Intent does not contain Extra with URI and params.

The test I wrote:

class Test {

    companion object {
        @ClassRule
        @JvmField
        val rule = ActivityTestRule<MyActivity>(MyActivity::class.java, true, false)
    }

    @Before
    fun setUp() {
        val intent: Intent = MyActivity.createIntent(false)
        rule.launchActivity(intent)
    }

    @Test
    fun firstTest() {
        onView(withId(R.id.switch))
                .check(matches(isDisplayed()))
                .perform(click())
        Screengrab.screenshot("testtest")
    }
}

I found out that onCreate in DeepLinkActivity is not called (the class which is annotated with @DeepLinkHandler(AppModule::class).

One way how to fix this could be adding missing EXTRA to the custom intent in setUp(), but this is something I don't want to do. It's a fragile solution and prone to future issues.

Any other ideas how to get espresso + deeplink running together?

BJJ
  • 31
  • 2

0 Answers0