【问题标题】:Use KIF to swipe from screen edge (test UIScreenEdgePanGestureRecognizer)?使用 KIF 从屏幕边缘滑动(测试 UIScreenEdgePanGestureRecognizer)?
【发布时间】:2016-02-25 18:15:03
【问题描述】:

到目前为止,我还无法在 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)
}

【问题讨论】:

  • 能够通过引用当前最前面的视图使menuView 通用。

标签: ios kif kif-framework


【解决方案1】:

试试:

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))")

【讨论】:

  • "" ^ 这对我来说很关键。我正在使用我想要显示的视图的标签。谢谢!
猜你喜欢
  • 2013-12-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-12-31
  • 1970-01-01
  • 2021-05-15
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多