【发布时间】:2015-12-08 19:44:54
【问题描述】:
例如, 我有一个草图板应用程序,我想通过在上面绘图来测试它。我想指定一个(x,y)坐标并使其点击并拖动到另一个(x,y)坐标。
这在 Xcode UI 测试中可行吗?
Joe 为这个问题提供了一个解决方案: 使用 Objective C,我的代码看起来像这样:
XCUICoordinate *start = [element2 coordinateWithNormalizedOffset:CGVectorMake(0, 0)];
XCUICoordinate *finish = [element2 coordinateWithNormalizedOffset:CGVectorMake(0.5, 0.5)];
[start pressForDuration:0 thenDragToCoordinate:finish];
element2 是我必须执行拖动的 XCUIElement。
【问题讨论】:
标签: testing xcode7 xcode-ui-testing