Robotium: How do I wait for loading to complete before proceeding?

user952342 picture user952342 · Feb 23, 2012 · Viewed 9k times · Source

I want to write a Robotium/Junit test for an android app. At certain steps, I want my test to wait until the spinning loading symbol disappears off the screen.

How can I do that?

Answer

Renas picture Renas · Feb 23, 2012

There are different ways in which you can do that. In Robotium there are a lot of different waitFor methods that you can use. In your case you can use:

solo.waitForDialogToClose() //waits for the dialog to close
solo.waitForActivity() // if there is a activity change
solo.waitForText() //if a certain text appears after the loading is done
solo.waitForView() //if a certain view is shown after the load screen is done.

Please see the Robotium API Documentation for more waitFor methods in Robotium.