iOS | XCUITest — How to Drag & Drop in tabular cells
Dec 25, 2021
func reorderMovableCellsInATable() { let videos = app
.tables[tableName]
.cells.element(boundBy: 0) // cell 0
.buttons[reorderVideos] let puzzles = app
.tables[tableName]
.cells.element(boundBy: 1) // cell 1
.buttons[reorderPuzzles] dragAndDrop(start: videos,
destination: puzzles,
duration: 0.5)
let football = app
.tables[tableName]
.cells.element(boundBy: 2) // cell 2
.buttons[reorderFootball] let reorderedVideos = app
.tables[tableName]
.cells.element(boundBy: 1) // cell 1
.buttons[reorderVideos] dragAndDrop(start: football,
destination: reorderedVideos,
duration: 0.5)
}func dragAndDrop(start: XCUIElement,
destination: XCUIElement,
duration: TimeInterval) { start.press(forDuration: duration,
thenDragTo: destination)
}