I have the following espresso code:
@Test
fun backgroundWorkDisplaysTextAfterLoading() {
onView(withId(R.id.btn_next_fragment)).perform(click())
onView(withId(R.id.btn_background_work)).perform(click())
onView(withId(R.id.hiddenTextView)).check(matches(isDisplayed()))
}
When the btn_background_work is clicked, there is a service call that will return a response in 2 seconds and then the hiddenTextview will become visible.
How can I let Espresso wait to execute the ViewAssertion ( check(matches(isDisplayed)) ) until this service call has returned a value? The service call is done with Retrofit and the service call is done on the Schedulers.io() thread.
I cannot touch the production code, so implementing IdlingResources in the production code is impossible.
Any help is appreciated!
Aucun commentaire:
Enregistrer un commentaire