android / android/android-test

"Overslept and turned a tap into a long press" should immediately fail test

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

Description

### 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"

Contributor guide

Open the contributing guide

Research direction

Use the reported flaky Espresso test and the MotionEvents warning as the starting point; investigate where a single-click action is recognized as a long press. Done means the test fails immediately at that conversion and reports the source condition rather than continuing to the missing-view assertion.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.