Xcode UI测试 - 拖放

ego*_*dan 2 xcode cocoa swift xcode-ui-testing xcode7-beta5

我正在尝试创建XCTestCase以在我的大纲视图中测试重新排序(在OS X应用程序中).当我使用UI测试记录功能时,Xcode打印出:

window.outlines.staticTexts["<cell which I want to move>"].click()
Run Code Online (Sandbox Code Playgroud)

我尝试在大纲视图的内部或外部拖动单元格,Xcode生成相同的无用代码.

有谁知道如何在Xcode 7中正确测试拖放?

har*_*isg 7

不确定这是否是新的,但在Xcode 7.2中,如果查看标题XCUIElement,则有clickForDuration(thenDragToElement:)OS X 的功能.似乎对我有用NSOutlineView.

这是从标题...

/*!
 * Clicks and holds for a specified duration (generally long enough to start a drag operation) then drags
 * to the other element.
 */
public func clickForDuration(duration: NSTimeInterval, thenDragToElement otherElement: XCUIElement)
Run Code Online (Sandbox Code Playgroud)