Dunno why espresso intermittently can't find a clearly visible elements. It fails with:
failed: android.support.test.espresso.NoMatchingViewException: No views in hierarchy found matching: with id: com.justyoyo.staging.debug:id/content_loading_progress_bar
It's freaking frustrating as it doesn't matter whether I'm running the tests on local physical devices, AWS device farm or on Genymotion's emulators. It also doesn't matter that I add an explicit wait SystemClock.sleep(5000);
before checking if the element is visible.
I works fine 2,3 times in a row, then it fails.
To give you more insights, we're using Dagger, Mortar and we're running the tests on the UI thread, as running them on separate one was even worse.