android / android/android-test
Espresso Hangs with TextInputLayout.setError
- Dominant language
- Java
- Stars
- 1.2k
- Forks
- 342
- Avg merge
- 11h 29m
- Merged PRs (30d)
- 2
Description
### Description
`TextInputLayout.setError` causes Espresso test to hang indefinitely. I believe this issue is specific to TextInputLayouts that are in dialogs.
### Steps to Reproduce
Simply run the `TextInputErrorTest` included in the linked GitHub project.
### Expected Results
The test should complete and pass as written.
### Actual Results
Espresso will hang indefinitely after clicking the "OK" button. The app itself works fine, but the test will hang and never return. I believe I've tracked this down to `Tap.java` line 170, espresso fails to return from `MotionEvents.sendUp`.
### AndroidX Test and Android OS Versions
Tested on Pixel 4 (Android 10), Emulator (Android 9) and a few other devices.
`implementation 'androidx.constraintlayout:constraintlayout:1.1.3'`
`implementation 'androidx.test.ext:junit:1.1.1'`
`androidTestImplementation 'androidx.test:runner:1.2.0'`
`androidTestImplementation 'androidx.test:rules:1.2.0'`
`androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'`
`androidTestImplementation 'androidx.annotation:annotation:1.1.0'`
`androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.2.0'`
`androidTestImplementation 'androidx.test.espresso:espresso-intents:3.2.0'`
`androidTestImplementation 'androidx.test.espresso:espresso-web:3.2.0'`
`androidTestImplementation 'androidx.test.espresso.idling:idling-concurrent:3.2.0'`
`androidTestImplementation 'androidx.test.espresso:espresso-idling-resource:3.2.0'`
`androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'`
`implementation 'com.google.android.material:material:1.1.0'`
### Link to a public git repo demonstrating the problem:
https://github.com/nverbeek/EspressoBug
Contributor guide
Research direction
Start by running the linked TextInputErrorTest in the EspressoBug reproduction project and confirm that the test hangs after clicking “OK” when TextInputLayout.setError is used in a dialog. Then inspect Tap.java around line 170, where the report identifies MotionEvents.sendUp as the point that does not return. Done means the reproduction test completes and passes on the affected Android and Espresso versions.
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