lundi 25 septembre 2017

Forcing action while app not idle in Espresso - Android

A lot of people have asked how to get the Espresso framework to wait for a background task to be finished before performing an action or asserting something. I understand that in those situations, IdlingResource is often the answer.

My question is sort of the opposite. I have a background task that Espresso waits for by default because the message queue is sent UI events to handle. During this background task, I have a sort of "Cancel" button to stop the background task.

The test I want to write will set up the background task and check that cancel button takes the app back to the previous screen. Right now it waits for the background task to finish before trying to click the cancel button but the cancel button disappears after the task is done.

How would I "force" Espresso to perform an action (click the cancel), even though the app is not idle?

Aucun commentaire:

Enregistrer un commentaire