开发者

Testing paginated UIScrollView on iPad

I'm creating a magazine reader (something like iGizmo on iPad). I have two scrollviews one that开发者_运维技巧 paginate over articles and second to paginate inside of an article through pages.

I'd like to check memory usage of my app after scrolling through 20 pages. To do so I decided to create an automated ui test that scrolls 20 times right and the check the memory foot print at the end of the test.

I need that info to have some metrics before I start optimizing the memory usage

And Here is the thing: I can't make the ui automation to pass to the second page. My automation code looks like that:

var window = UIATarget.localTarget().frontMostApp().mainWindow(); 
var articleScrollView = window.scrollViews()[0]; 
articleScrollView.scrollRight(); 
// do you know any command to wait until first scrolls ends?
articleScrollView.scrollRight(); // this one doesn't work

I guess that I need to wait for the first scorlling to end before I can run another one, but I don't know how to do that as each page is just an image. (I don't have anything else on pages yet)

Any idea?


try inserting a delay of 1 or 2 seconds between the consecutive scrolls.

This works for me. Hope it does for you too.

var window = UIATarget.localTarget().frontMostApp().mainWindow();
target = UIATarget.localTarget();
var articleScrollView = window.scrollViews()[0];
target.delay(1); //delay of 1 second articleScrollView.scrollRight();
// do you know any command to wait until first scrolls ends?
target.delay(1); //delay of 1 second
articleScrollView.scrollRight(); // this one doesn't work

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜