android / android/android-test

Espresso does not wait for AndroidX's ListAdapter's by default

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

Description

### Description

Included `androidx.recyclerview.widget.ListAdapter` performs asynchronous operations in the background. However, Espresso does not appear to be aware of it and thus tests can fail if async list diff is still diffing while Espresso starts inspecting views.

### Steps to Reproduce

1. Download [RecyclerTest.zip](https://github.com/android/android-test/files/3264598/RecyclerTest.zip)
2. Run ExampleInstrumentedTest couple of times, at least one test will fail eventually

### Expected Results

Espresso should wait for built-in ListAdapter to finish diffing

### Actual Results

Espresso does not wait and can fail the test

Contributor guide

Open the contributing guide

Research direction

Download RecyclerTest.zip and run ExampleInstrumentedTest repeatedly to reproduce the intermittent failure. Trace how Espresso synchronizes with androidx.recyclerview.widget.ListAdapter's asynchronous diffing. Done means Espresso waits for the built-in ListAdapter diff to finish and the reproduced test no longer fails intermittently.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
mobile, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.