Xcode7 ui 测试:staticTexts[“XX"].swipeRight() 滑动不够远 [英] Xcode7 ui testing: staticTexts["XX"].swipeRight() swipes not far enough

查看:42
本文介绍了Xcode7 ui 测试:staticTexts[“XX"].swipeRight() 滑动不够远的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于 UI 测试,我想执行 swipeRight 手势以使更多按钮可访问.我要滑动的元素在屏幕底部.我通过以下方式访问它:

For UI testing I want to perform a swipeRight-gesture to make further buttons accessible. The element I want to swipe is at the bottom of the screen. I access it by:

element.staticTexts["TEST TEXT"].swipeRight()

执行测试时,滑动不够远.它不会触发元素完全向右滑动并显示我想要点击的其他按钮.

When performing the test the swipe goes not far enough. It does not trigger the element to slide completely to the right and show the further buttons I want to tap.

我感觉 swipeRight() 抓取静态文本的中间并执行手势.

I have the feeling that swipeRight()grabs the middle of the static text and performs the gesture.

是否有可能更多地向左抓取元素,使其向右滑动更多?

Is there any possibility to grab the element more to the left, such that it slides more to the right?

感谢您的任何建议!

推荐答案

试试这个方法:

    let startPoint = element.staticTexts["TEST TEXT"].coordinateWithNormalizedOffset(CGVectorMake(0, 0)) // center of the element
    let finishPoint = startPoint.coordinateWithOffset(CGVectorMake(1000, 0))
    startPoint.pressForDuration(0, thenDragToCoordinate: finishPoint)

你可以调整1000来达到你想要的效果.

You can adjust 1000 to reach the effect you want.

这篇关于Xcode7 ui 测试:staticTexts[“XX"].swipeRight() 滑动不够远的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆