android / android/android-test

Flaky Espresso.intended() won't find anything sometimes

Open
#644 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.2k
Forks
342
Avg merge
11h 29m
Merged PRs (30d)
2

Description

### Description
Flaky Espresso.intended() won't find anything sometimes.

### Steps to Reproduce
Run the test proveEspressoIntendedIssue0 here: https://github.com/mobilekosmos/EspressoDialogsIssue/blob/master/app/src/androidTest/java/com/issues/espressoidling/MainActivity2Test.kt

The issue doesn't only happen because of using the loop, this is also happening when running the test manually, but difficult to reproduce when doing so, it works a few times, then it doesn't, therefore the loop where it was always reproducible till now on a Pixel 3a.

### Expected Results
Espresso.intended() shuould always find a view.

### Actual Results
Sometimes Espresso.intended() will hang and not find anything.

### AndroidX Test and Android OS Versions
Android R Preview 4
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'androidx.test.espresso:espresso-idling-resource:3.1.1'
androidTestImplementation("androidx.test.espresso:espresso-intents:3.2.0")

### Link to a public git repo demonstrating the problem:
https://github.com/mobilekosmos/EspressoDialogsIssue/blob/master/app/src/androidTest/java/com/issues/espressoidling/MainActivity2Test.kt

Contributor guide

Open the contributing guide

Research direction

Start by running proveEspressoIntendedIssue0 in app/src/androidTest/java/com/issues/espressoidling/MainActivity2Test.kt from the linked reproduction repository, using the listed AndroidX Test and Android R Preview 4 versions. Investigate why Espresso.intended() intermittently hangs or finds no view; done means the test reliably finds the expected view across repeated runs.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile-dev, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.