android / android/android-test
Espresso longClick is performed in subsequent activities (in AVD, API 29)
- Dominant language
- Java
- Stars
- 1.2k
- Forks
- 342
- Avg merge
- 11h 29m
- Merged PRs (30d)
- 2
Description
### Description
Espresso longClick is performed in subsequent activities. This happens in AVD with API level 29. Same tests ran against real device works fine (same API level).
### Steps to Reproduce
Assume you have following app:
- main activity have a view that has a longClick listener that sends you to second activity
- second activity have a view that has a longClick listener that sends you to third activity
When you try to perform longClick on that view in main acitivity with Espresso, the long click is carried over to second activity and it's triggered again, resulting in loading third activity
When the same scenario is done with ui-automator, long click works fine.
Please also note that it's reproducible in AVD. On real device (tried on Samsung Galaxy S10) it works fine.
### Expected Results
longClick should only be performed on single view.
### Actual Results
Espresso longClick is performed in subsequent activities
androidx.test.espresso.PerformException: Error performing 'long click' on view 'with id: com.example.espressoviewaction:id/text'.
...
Caused by: java.lang.RuntimeException: Couldn't click at: 539.5,1153.5 precision: 16.0, 16.0 . Tapper: LONG coordinate provider: CENTER precision describer: FINGER. Tried 3 times. With Rollback? false
...
### AndroidX Test and Android OS Versions
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test:rules:1.2.0'
androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
Tried on API 29
### Link to a public git repo demonstrating the problem:
Example app and both espresso and ui-automator tests can be found here: https://github.com/pmichalskiGD/EspressoViewAction
Contributor guide
Research direction
Start by running the public EspressoViewAction repository on an API 29 AVD and compare its Espresso and UI Automator tests. Trace how the long click is delivered when the first activity transitions to the second. Done means a long click triggers only the view in the current activity and the reproduction no longer reaches the third activity.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- mobile-dev, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100