arefin
arefin

Reputation: 365

When Activity loads completely with Monkeyrunner

My app has an activity which loads some images from server. So, naturally it takes some time to load the activity completely, as it is fetching images from server.

I need to know when the activity loads completely from Monkeyrunner. And if it creates Error when fetching images from server, how I can know about this Error from Monkeryrunner.

Please advise me.

Upvotes: 0

Views: 473

Answers (1)

Diego Torres Milano
Diego Torres Milano

Reputation: 69208

This would not be exactly the same as your app but you'll get the idea. The solution is based on AndroidViewClient/culebra.

I'm using the Progress dialog example from API Demos so it will be easily reproducible by anyone.

When you press API Demos -> App/Alert Dialogs you obtain

Progress dialog

then you can run culebra to automatically generate a test script

$ culebra -VC -t on -r -o myscript.py

edit the script to remove the unneeded Views and loop while progress is being incremented

# generated script lines removed for clarity
while True:
    vc.dump(window='-1')
    no_id15 = vc.findViewWithTextOrRaise(re.compile('\d+/100'))
    print no_id15.getText()

the output would be

Connecting to a device with serialno=.* with a timeout of 60 secs...
Connected to device with serialno=.*
Actual device serialno=emulator-5554
21/100
24/100
26/100
28/100
...
98/100
100/100

Upvotes: 1

Related Questions