6

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?

Ahmad
  • 69,608
  • 17
  • 111
  • 137
user952342
  • 2,602
  • 7
  • 34
  • 54

1 Answers1

13

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.

durbon
  • 158
  • 3
  • 12
Renas
  • 1,919
  • 1
  • 18
  • 17
  • Thanks... it seems to work but takes longer than I expected when I use this command: `solo.waitForActivity(solo.getCurrentActivity().toString());` – user952342 Feb 23 '12 at 17:45
  • @Renas If i want to wait for horizontal progress bar means, how could i use these methods? – Mani Oct 16 '13 at 05:21
  • solo.waitForDialogToClose() will not work if u have alert dialog immediately after progressdialog, robotium will will wait for alert dialog to close. – Suru Jul 17 '14 at 09:43