android / android/android-test

Espresso.openActionBarOverflowOrOptionsMenu sometimes performs long click

Open
#423 0 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
Inside openActionBarOverflowOrOptionsMenu is a call to ViewActions.click(). Creating click actions this way is flaky on devices that are prone to interpret short-clicks as long-clicks. It would be preferred to use the ViewAction.click(ViewAction rollbackAction) constructor instead, or least provide the option.

### Steps to Reproduce
Run an Espresso test which calls openActionBarOverflowOrOptionsMenu on A.) slow device, or B.) any device with a very short long-click timeout (you can configure this via ADB: `adb shell settings put secure long_press_timeout 10`).

### Expected Results
If a long-click is accidentally performed, Espresso will be given a chance to roll-back its effects before re-trying it.

### Actual Results
Espresso performs an undesirable long-click; the test does not proceed as expected.

### AndroidX Test and Android OS Versions
AndroidX: 1.2.0
Espresso: 3.2.0
Android OS: API 23

### Link to a public git repo demonstrating the problem:
Unfortunately I am not permitted to share my employer's code.

Contributor guide

Open the contributing guide

Research direction

Start at Espresso.openActionBarOverflowOrOptionsMenu and inspect the ViewActions.click() call described in the issue. Reproduce with an Espresso test on a slow device or with the reduced long-press timeout using adb. Done means accidental long-click effects are rolled back before retrying, or the requested rollback option is available.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
mobile, testing
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.