在带有 Xcode7 的 UITest 中使用“-[XCUIElement swipeDown]”时如何设置滑动距离

How can I set the swipe distance when using '-[XCUIElement swipeDown]' in UITest with Xcode7

XCUIElement.h class 文件显示
- (void)scrollByDeltaX:(CGFloat)deltaX deltaY:(CGFloat)deltaY;
- (XCUICoordinate *)coordinateWithNormalizedOffset:(CGVector)normalizedOffset; 函数。但是这些不能在 iOS 设备上使用。 XCUIElement.h 提供- (void)swipeDown 滑动tableview。由于下拉距离不够,无法响应像MJRefresh一样的下拉刷新框架
那么如何自定义位置或使用存在功能来编辑向下滑动距离?

您可以下拉到坐标 API 以执行下拉刷新。

let firstCell = app.staticTexts["Cell One"]
let start = firstCell.coordinateWithNormalizedOffset(CGVectorMake(0, 0))
let finish = firstCell.coordinateWithNormalizedOffset(CGVectorMake(0, 6))
start.pressForDuration(0, thenDragToCoordinate: finish)

我已经 more information along with a working sample app 放在我的博客上了。