android / android/android-test
Intents.assertNoUnverifiedIntents() should ignore `BootstrapActivity` intents
- Dominant language
- Java
- Stars
- 1.2k
- Forks
- 342
- Avg merge
- 11h 29m
- Merged PRs (30d)
- 2
Description
### Description
Launching an activity with `ActivityScenario` adds extra unexpected intents.
When you call `Intents.assertNoUnverifiedIntents()` you get a failure.
`BootstrapActivity` intents should be ignored for purposes of `assertNoUnverifiedIntents()`, it is just an impl detail.
### Steps to Reproduce
Use `ActivityScenario` to launch a flow, call `intended(..)` on all the activities in the flow, then call `Intents.assertNoUnverifiedIntents()`
### Expected Results
no failure.
### Actual Results
```
Caused by: junit.framework.AssertionFailedError: Found unverified intents.
Unverified intents:
-Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10008000 cmp=com.example.test/androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity (has extras) } handling packages:[[com.example.test]], extras:[Bundle[{androidx.test.core.app.InstrumentationActivityInvoker.TARGET_ACTIVITY_OPTIONS_BUNDLE_KEY=null, androidx.test.core.app.InstrumentationActivityInvoker.START_TARGET_ACTIVITY_INTENT_KEY=PendingIntent{47de493: android.os.BinderProxy@1f14cd0}}]])
Recorded intents:
-Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10008000 cmp=com.example.test/androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity (has extras) } handling packages:[[com.example.test]], extras:[Bundle[{androidx.test.core.app.InstrumentationActivityInvoker.TARGET_ACTIVITY_OPTIONS_BUNDLE_KEY=null, androidx.test.core.app.InstrumentationActivityInvoker.START_TARGET_ACTIVITY_INTENT_KEY=PendingIntent{47de493: android.os.BinderProxy@1f14cd0}}]])
at junit.framework.Assert.fail(Assert.java:50)
at androidx.test.espresso.intent.VerificationModes$NoUnverifiedIntents.verify(VerificationModes.java:54)
at androidx.test.espresso.intent.Intents.internalIntended(Intents.java:348)
at androidx.test.espresso.intent.Intents$2.check(Intents.java:196)
at androidx.test.espresso.ViewInteraction$SingleExecutionViewAssertion.check(ViewInteraction.java:10)
at androidx.test.espresso.ViewInteraction$2.call(ViewInteraction.java:11)
at androidx.test.espresso.ViewInteraction$2.call(ViewInteraction.java:2)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
```
### AndroidX Test and Android OS Versions
Android X Test 1.3.0 and API 23
Contributor guide
Research direction
Start with Intents.assertNoUnverifiedIntents() and VerificationModes.NoUnverifiedIntents, then trace how the BootstrapActivity intent from ActivityScenario is recorded and checked. Reproduce the failure with the steps provided on Android X Test 1.3.0/API 23. Done means BootstrapActivity intents no longer cause assertNoUnverifiedIntents() to fail while other unverified intents still do.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- mobile-dev, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100