Instrumental Test: Better Espresso without sleep

Sometimes due to network fetching, we need to add Thread.sleep(..) or SystemClock.sleep(...) so that our instrumental test could be run and pass. This blog will show you how to eliminate the need of sleep in your instrumental test.

Example App to Test

Assuming we have an app the perform a network fetch as below.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store