Question

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.

Was it helpful?

Solution

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top