如何执行“向左滑动”操作以通过Xcode中的UI测试触发Segue并更改视图控制器?如何通过UI测试执行“向左滑动”操作
记录的代码是
[[[[[[[XCUIApplication alloc] init].otherElements containingType:XCUIElementTypeNavigationBar identifier:@"UIView"] childrenMatchingType:XCUIElementTypeOther].element childrenMatchingType:XCUIElementTypeOther].element childrenMatchingType:XCUIElementTypeOther].element tap];
但似乎这是行不通的 - 据我看到的,视图控制器不会更改为新的。
是的,它的工作原理,非常感谢。为什么我的测试应用程序几次顺便运行?我只有stub方法'setUp'和'tearDown'和**一个** UI测试,下面的代码 - 'XCUIApplication * app = [[XCUIApplication alloc] init]; [app.images [@“swipeleft”] swipeLeft]; XCUIElement * element = app.buttons [@“icon share”]; [self waitForElementToAppear:element withTimeout:5];' – FrozenHeart
@Joe Masilotti我可以更轻松地处理滑动左手势吗?例如向左滑动距离? –
@RyanChou你可以下载到'XCUICoordinate' API并从一个元素拖到另一个元素。查看[这个拉到更新的例子](http://masilotti.com/ui-testing-cheat-sheet/#how-to-quot-pull-to-refresh-quot)。 –