Espresso test fails due to: androidx.test.espresso.AppNotIdleException. The following Idle Conditions failed MAIN_LOOPER_HAS_IDLED

Viewed 435

In my Espresso test I get the following exception: androidx.test.espresso.AppNotIdleException: Looped for 10945 iterations over 60 SECONDS. The following Idle Conditions failed MAIN_LOOPER_HAS_IDLED(last message: { when=-5ms callback=android.view.Choreographer$FrameDisplayEventReceiver target=android.view.Choreographer$FrameHandler })

I switched off animation on my android emulator. I read topics where was written that this problem occurs due to ProgressBar change the state to GONE. I was checking and don't sure that this problem related to this. Maybe someone faced with this exception and can help me.

1 Answers

I just had the same problem. The issue occurred, because there was a UI part updating all the time (not an animated one, but a problem in my code caused it). Espresso waits until no more task (even background task) is executed on UI thread, as it uses this thread to do the checks.

To find out whether this is the case, you can switch on hardware layer updates in developer options ("Show hardware layer updates").

Related