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

How to write a scroll UIScrollView test? #12

Closed xhzengAIB closed 9 years ago

xhzengAIB commented 9 years ago

Hi!@jonathanpenn I have main page, Take a UIScrollView in this page.

Jack

jonathanpenn commented 9 years ago

Hey @xhzengAIB, I'm not quite sure what you're asking for. You can interact with a scroll view using a drag gesture on the element. But the Auto Monkey's whole purpose is to randomly interact with the screen and it wasn't written to talk to specific elements in a certain way. You could certainly write your own custom gesture support with these instructions. But it's still going to be random.

xhzengAIB commented 9 years ago

Hi! @jonathanpenn My English is very bad, I'm really sorry.
Thank you very much for your reply, I know you can write custom gestures, but how should I write about a random location sliding UIScrollview gesture?

Jack

jonathanpenn commented 9 years ago

No worries, @xhzengAIB. Glad to help! Though it sounds like this script won't do what you want. It's for sending touch events to the entire screen and doesn't target specific views.

But if you wanted to still do "drag" events all over the screen, I'd recommend looking into the dragFromToForDuration method on UIATarget at Apple's documentation:

https://developer.apple.com/library/ios/documentation/ToolsLanguages/Reference/UIATargetClassReference/#//apple_ref/javascript/instm/UIATarget/dragFromToForDuration

That should get you on the right path.

xhzengAIB commented 9 years ago

Hi!@jonathanpenn Thank you! I got it.