jonathanpenn / ui-auto-monkey

UI AutoMonkey is a simple stress testing script for iOS applications that runs in UI Automation and Instruments. Grass fed. Free range.
http://cocoamanifest.net
MIT License
1.47k stars 249 forks source link

Function: lockForDuration() is failed to unlock the simulator #11

Open JohnnyWuMigme opened 9 years ago

JohnnyWuMigme commented 9 years ago

Hi Jonathan, please allow me to call you teacher. Thanks for your great book and tool, I really studied a lot from them.

I encounter a problem in using the Monkey tool. When I call lockForDuration() in my script, most of time it's unable to unlock the simulator (sometimes it could, I don't know why), the log shows:

2015-02-16 14:02:06 +0000 Debug: target.lockForDuration("0.01863725995644927") 2015-02-16 14:02:07 +0000 Debug: target.systemApp().mainWindow().scrollViews().firstWithPredicate("ANY elements.name == 'SlideToUnlock' OR ANY elements.name == 'SlideToSetup' OR ANY elements.name == 'Passcode field'").dragInsideWithOptions({endOffset:{x:0.90,y:0.90}}, duration:"0.5", startOffset:{x:0.20,y:0.90}}}) 2015-02-16 14:02:09 +0000 Debug: Unlock failed. Retrying up to 2 more time(s). 2015-02-16 14:02:09 +0000 Debug: target.systemApp().mainWindow().scrollViews().firstWithPredicate("ANY elements.name == 'SlideToUnlock' OR ANY elements.name == 'SlideToSetup' OR ANY elements.name == 'Passcode field'").dragInsideWithOptions({endOffset:{x:0.90,y:0.90}}, duration:"0.5", startOffset:{x:0.20,y:0.90}}}) 2015-02-16 14:02:10 +0000 Debug: Unlock failed. Retrying up to 1 more time(s). 2015-02-16 14:02:10 +0000 Debug: target.systemApp().mainWindow().scrollViews().firstWithPredicate("ANY elements.name == 'SlideToUnlock' OR ANY elements.name == 'SlideToSetup' OR ANY elements.name == 'Passcode field'").dragInsideWithOptions({endOffset:{x:0.90,y:0.90}}, duration:"0.5", startOffset:{x:0.20,y:0.90}}})

I use Xcode 6.1, simulator is iPhone 6. I want to trace the lockForDuration() but I don't know where the code is in my OSX. Do you have any idea or hint that I can move on? Thanks teacher!

skrach commented 9 years ago

I have the same problem. UIATarget.lockForDuration()successfully locks the device, but fails to unlock it afterwards. It seems as if the sliding gesture to unlock the device is not sufficient.

jonathanpenn commented 9 years ago

Alas, if the function isn't working, then it is the fault of the Automation instrument and the script can address the problem. File a bug with Apple and post the bug number here for reference for anyone to dupe.

JohnnyWuMigme commented 9 years ago

Bug number: 19933099 https://bugreport.apple.com/problem/viewproblem

Thanks all!