android / android/android-test
Forever blocking "take()" in androidx.test.espresso.InteractionResultsHandler
- Dominant language
- Java
- Stars
- 1.2k
- Forks
- 342
- Avg merge
- 11h 29m
- Merged PRs (30d)
- 2
Description
### Description
Forever blocking "take()" running simple "perform Click" test.
Basically, this call
https://github.com/android/android-test/blob/master/espresso/core/java/androidx/test/espresso/InteractionResultsHandler.java#L83
blocks the main thread.
There are 2 iterations.
1st `result` is following
```
androidx.test.espresso.core.internal.deps.guava.util.concurrent.TrustedListenableFutureTask@d78c3e0[
status=FAILURE, cause=[androidx.test.espresso.remote.NoRemoteEspressoInstanceException: No remote instances available]]
```
and during 2nd iteration, `take()` call doesn't ever leave.
Using older version and ActivityTestRule in following branch, works as expected
https://github.com/jbruchanov/InstrumentationTestDeadlock/tree/works
### Steps to Reproduce
Used AS4 app template.
Run instrumentation test `com.scurab.android.myapplication.ExampleInstrumentedTest#testDeadLock`
from following repo
### Expected Results
Test should end
### Actual Results
Test blocked forever.
### AndroidX Test and Android OS Versions
AndroidX versions please take a look the repo >>>
PC
```
OS Name: Microsoft Windows 10 Pro
OS Version: 10.0.18362 N/A Build 18362
java version "1.8.0_231"
Java(TM) SE Runtime Environment (build 1.8.0_231-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.231-b11, mixed mode)
```
Emulator:
```
Name: Pixel_3a_API_29
CPU/ABI: Google Play Intel Atom (x86)
Path: C:\Users\Scurab\.android\avd\Pixel_3a_API_29_1.avd
Target: google_apis_playstore [Google Play] (API level 29)
Skin: pixel_3a
SD Card: 512M
fastboot.chosenSnapshotFile:
runtime.network.speed: full
hw.accelerometer: yes
hw.device.name: pixel_3a
hw.lcd.width: 1080
hw.initialOrientation: Portrait
image.androidVersion.api: 29
tag.id: google_apis_playstore
hw.mainKeys: no
hw.camera.front: emulated
avd.ini.displayname: Pixel 3a API 29
hw.gpu.mode: auto
hw.ramSize: 1536
PlayStore.enabled: true
fastboot.forceColdBoot: no
hw.cpu.ncore: 4
hw.keyboard: yes
hw.sensors.proximity: yes
hw.dPad: no
hw.lcd.height: 2220
vm.heapSize: 256
skin.dynamic: yes
hw.device.manufacturer: Google
hw.gps: yes
hw.audioInput: yes
image.sysdir.1: system-images\android-29\google_apis_playstore\x86\
showDeviceFrame: yes
hw.camera.back: virtualscene
AvdId: Pixel_3a_API_29
hw.lcd.density: 440
hw.arc: false
hw.device.hash2: MD5:0e6953ebf01bdc6b33a2f54746629c50
fastboot.forceChosenSnapshotBoot: no
fastboot.forceFastBoot: yes
hw.trackBall: no
hw.battery: yes
hw.sdCard: yes
tag.display: Google Play
runtime.network.latency: none
disk.dataPartition.size: 6442450944
hw.sensors.orientation: yes
avd.ini.encoding: UTF-8
hw.gpu.enabled: yes
```
### Link to a public git repo demonstrating the problem:
Blocking
https://github.com/jbruchanov/InstrumentationTestDeadlock/blob/master/app/src/androidTest/java/com/scurab/android/myapplication/ExampleInstrumentedTest.kt
Older version which is working fine
https://github.com/jbruchanov/InstrumentationTestDeadlock/blob/works/app/src/androidTest/java/com/scurab/android/myapplication/ExampleInstrumentedTest.kt
Contributor guide
Research direction
Start at espresso/core/java/androidx/test/espresso/InteractionResultsHandler.java:83 and reproduce the hang with com.scurab.android.myapplication.ExampleInstrumentedTest#testDeadLock from the linked repository. Compare the current behavior with the works branch and verify that the instrumentation test completes instead of blocking forever.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- 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