android / android/android-test
ActivityScenario hangs on EmptyActivity after testing activity with launchMode=singleInstance
- Dominant language
- Java
- Stars
- 1.2k
- Forks
- 342
- Avg merge
- 11h 29m
- Merged PRs (30d)
- 2
Description
### Description
When testing an Activity that has `launchMode=singleInstance` with an ActivityScenarioRule, after the test is completed the text executor gets stuck in EmptyActivity for ~45 seconds before progressing to the next test.
### Steps to Reproduce
* Create a new Android project in Android Studio using the project wizard, using e.g. the "Blank Activity" template.
* Add `android:launchMode="singleInstance"` to the MainActivity's entry in AndroidManifest.xml
* Add `@get:Rule val rule = ActivityScenarioRule(MainActivity::class.java)` to the `ExampleInstrumentedTest`
* Run `ExampleInstrumentedTest`
### Expected Results
Test runs and quits immediately after
### Actual Results
Test runs and gets stuck in EmptyActivity for about ~45 seconds
### AndroidX Test and Android OS Versions
```
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
```
(physical) Pixel C, Android 8.1.0
(emulator) Pixel 2, API 30
Contributor guide
Research direction
Start by reproducing the hang with ActivityScenarioRule in ExampleInstrumentedTest after setting launchMode="singleInstance" in AndroidManifest.xml. Observe the transition into EmptyActivity on the Pixel C or API 30 emulator and trace the test teardown path. Done means the test exits immediately after completion instead of waiting about 45 seconds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- mobile, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100