re: adding sleeps everywhere to tests
Do not put sleeps in Espresso tests. That is not a “solution.” Companies investing in automation require tests to pass consistently and quickly. Neither of those goals are possible with sleeps. Espresso as a framework is designed around the concept of idle resource listeners. The idea is the app tells Espresso when to wait or not, without having to hardcode this into the tests. The Android emulators provided by Google are not suitable for Espresso testing at scale. They are simply too flaky. Google’s Firebase Test Lab is the best option in the market today for virtual device testing on Android.