How do I briefly click and drag and drop script scripts in the Xcode interface?

For example, I have a sketch application that I want to test based on it. I would like to indicate the coordinate (x, y) and make it pressed and drag to another coordinate (x, y).

Is this possible in Xcode user interface tests?

Joe provided a solution to this problem: Using lens C, my code looked something like this:

XCUICoordinate *start = [element2 coordinateWithNormalizedOffset:CGVectorMake(0, 0)];
XCUICoordinate *finish = [element2 coordinateWithNormalizedOffset:CGVectorMake(0.5, 0.5)];
[start pressForDuration:0 thenDragToCoordinate:finish];

where element2was XCUIElement, I had to drag and drop.

+3
source share
1 answer

XCUICoordinate, . , .

let firstCell = app.staticTexts["Adrienne"]
let start = firstCell.coordinateWithNormalizedOffset(CGVectorMake(0, 0))
let finish = firstCell.coordinateWithNormalizedOffset(CGVectorMake(0, 6))
start.pressForDuration(0, thenDragToCoordinate: finish)

, XCUIApplication.

let app = XCUIApplication()
let fromCoordinate = app.coordinateWithNormalizedOffset(CGVector(dx: 0, dy: 10))
let toCoordinate = app.coordinateWithNormalizedOffset(CGVector(dx: 0, dy: 20))
fromCoordinate.pressForDuration(0, thenDragToCoordinate: toCoordinate)

UI Testing , XCTest Reference, .

+18

Source: https://habr.com/ru/post/1628001/


All Articles