android / android/android-test

Espresso not triggering SelectionTracker

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

Description

### Description

A ```longClick()``` with ```RecyclerViewActions.actionOnItemAtPosition``` does not trigger the selection of the item in a ```RecyclerView``` that has been passed to a ```SelectionTracker```.

### Steps to Reproduce

Set up a ```SelectionTracker``` with a ```RecyclerView``` in a ```Fragment```.

Use ```launchActivity``` and ```onActivity``` set the ```Fragment``` to the ```Activity```.

```longClick()``` an item in the ```RecyclerView```

Notice that nothing was selected.

It is worth noting that if debugging, and at a breakpoint, if you manually ```longClick()```, a selection will be triggered.

### Expected Results

The ```SelectionTracker``` to be triggered by a ```longClick()``` on an item in the ```RecyclerView``` passed to it, therefore triggering a selection.

### Actual Results

The ```SelectionTracker``` was not triggered by a ```longClick()``` on an item in the ```RecyclerView``` passed to it, and a selection was not triggered.

### AndroidX Test and Android OS Versions

androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.4.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

Android 11

Here is some context:

https://stackoverflow.com/questions/72538316/how-do-you-use-espresso-to-test-a-selectiontracker?noredirect=1#comment128138564_72538316

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue using launchActivity and onActivity with a Fragment, RecyclerViewActions.actionOnItemAtPosition, and longClick(), comparing Espresso 3.4.0 on Android 11 with a manual long-click. Trace why SelectionTracker is not triggered and verify that the automated long-click produces the expected selection.

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
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.