Fixed
Status Update
Comments
nk...@google.com <nk...@google.com>
nk...@google.com <nk...@google.com> #2
Will be fixed in the next version of Espresso (Espresso-core-3.0.2-alpha2 and above)
Description
Version used: 3.0.1
What steps will reproduce the problem?
1. register CountingIdlingResource in IdlingRegistry.getInstance().register()
2. launch Activity in test which performs some async operation (in worker thread which is monitored by CountingIdlingResource registered in previous step )
3. dont't use any of Espresso.onView, onData, registerIdlingResources
4. use Espresso.onIdle to check something not related with UI which should happen after async operation
How are you running your tests (via Android Studio, Gradle, adb, etc.)?
Android Studio
What is the expected output? What do you see instead?
Expected: test passed
Actual: test fail because onIdle does not wait for CountingIdlingResource
Reason:
Espresso registers IdlingResource's from IdlingRegistry to IdlingResourceRegistry by nvoking IdlingResourceRegistry.sync method. It does not invoke it in onIdle.
Everything works as expected if before onIdle there is Espresso.onView call.