使用 KIF 从屏幕边缘滑动(测试 UIScreenEdgePanGestureRecognizer)?

Use KIF to swipe from screen edge (test UIScreenEdgePanGestureRecognizer)?

到目前为止,我无法在 KIF 中进行边缘滑动(特别是 运行 针对设备的 KIF 测试)。有人成功了吗?我错过了什么吗?

结果函数:

func panInViewFromLeftScreenEdge() {
    // Grab the menu & its frame.
    let menuView = UIApplication.sharedApplication().keyWindow!.subviews.last!
    let frame = menuView.bounds

    // Simulate a drag from the left edge to the right edge.
    let startPoint = CGPointMake(CGRectGetMinX(frame), CGRectGetMidY(frame))
    let endPoint = CGPointMake(CGRectGetMaxX(frame), CGRectGetMidY(frame))

    menuView.dragFromPoint(startPoint, toPoint: endPoint)
}

尝试:

let view = tester().waitForViewWithAccessibilityLabel("<The view controller on screen's view's accessibility label")
view.dragFromPoint(CGPoint(x: 1, y: 150), toPoint: CGPoint(x: 40, y: 150))")