android / android/android-test
"Overslept and turned a tap into a long press" should immediately fail test
- Vorherrschende Sprache
- Java
- Sterne
- 1.2k
- Forks
- 342
- Ø Merge
- 11 Std. 29 Min.
- Gemergte PRs (30 T.)
- 2
Beschreibung
### Description
We have a flaky test that is caused by `Overslept and turned a tap into a long press`
```
09-10 18:05:56.883: I/ViewInteraction(28516): Performing 'single click' action on view with id: com.example.debug:id/action_audio_settings
...
09-10 18:05:57.508: W/MotionEvents(28516): Overslept and turned a tap into a long press
...
09-10 18:05:57.654: E/TestRunner(28516): failed: somTest(com.example.SomeTestClass)
09-10 18:05:57.654: E/TestRunner(28516): ----- begin exception -----
09-10 18:05:57.656: E/TestRunner(28516): androidx.test.espresso.NoMatchingViewException: No views in hierarchy found matching: with id: com.example:id/some_view
```
The problem is that the single click turns into long click which does not correctly nav to next screen which then leads to no matching view.
### Steps to Reproduce
Flaky test, not easily reproducible
### Expected Results
Ideally the test should fail as soon as we enter an indeterminant state. If a tap gets converted to a long press at random then who knows where the rest of the test will lead.
This makes it very difficult to track the source of the failure. I would rather the test was flaky but failed at the source of the problem (system / espresso timing).
### AndroidX Test and Android OS Versions
const val AndroidX_Junit = "androidx.test.ext:junit:1.1.1"
const val AndroidX_TestRunner = "androidx.test:runner:1.2.0"
const val AndroidX_TestRules = "androidx.test:rules:1.2.0"
const val AndroidX_Test_Orchestrator = "androidx.test:orchestrator:1.2.0"
private const val espressoVersion = "3.2.0"
const val Espresso_Core = "androidx.test.espresso:espresso-core:$espressoVersion"
const val Espresso_IdlingResource = "androidx.test.espresso:espresso-idling-resource:$espressoVersion"
const val Espresso_Contrib = "androidx.test.espresso:espresso-contrib:$espressoVersion"
Beitragsleitfaden
Rechercherichtung
Verwende den gemeldeten flakey Espresso-Test und die Warnung zu MotionEvents als Ausgangspunkt; untersuche, wo eine Single-Click-Aktion als Long Press erkannt wird. Als erledigt gilt die Aufgabe, wenn der Test unmittelbar bei dieser Umwandlung fehlschlägt und die ursprüngliche Bedingung meldet, anstatt mit der Assertion zur fehlenden View fortzufahren.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- android, java
- Bereich
- mobile, testing-qa
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 25/100