android / android/android-test

Espresso sometimes does not wait enough for RecyclerView with setHasFixedSize(true) to load

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

Description

Steps to reproduce:

1. Open attached project
2. Run ExampleInstrumentedTest couple of times, at least one test will fail eventually

If you add Thread.Sleep to the test or remove setHasFixedSize(true), tests will stop failing
[RecyclerTest.zip](https://github.com/android/android-test/files/2927839/RecyclerTest.zip)

Migrated from: https://issuetracker.google.com/123653014

Contributor guide

Open the contributing guide

Research direction

Start with the attached RecyclerTest.zip project and run ExampleInstrumentedTest repeatedly, comparing behavior with setHasFixedSize(true), with it removed, and with the added Thread.Sleep. Use the intermittent failure as the baseline; done means the test reliably waits for the RecyclerView without requiring either workaround.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.