Search code examples
androidandroid-espressoandroid-testingandroid-orchestrator

How to debug why espresso is stuck (app is not idle, timeout, AppNotIdleException exception)?


When working with espresso, I often come to a point where espresso is stuck (e.g. on onView(withId(R.id.somebutton)).perform(click()) ) waiting for all resources idling, which from what I know can be animations, background tasks, runnables in queue, etc. Currently the only message I receive is:

E/TestRunner: androidx.test.espresso.PerformException: Error performing 'single click - At Coordinates: 359, 1291 and precision: 16, 16' on view 'with id: com.example:id/somebutton'.
(...)
Caused by: androidx.test.espresso.AppNotIdleException: Looped for 7 iterations over 60 SECONDS. The following Idle Conditions failed .

The app is very complex, is there anything that can help narrowing down what is causing the espresso to consider the app is not idle?


Solution

  • You can check here https://stackoverflow.com/a/75015717/10856090 To be able to dump the threads that are running when your test fail. Could be useful to narrow down your issue.