XCTest Fast Swipe

I would like to create custom swipes for XCTest that just shorten the test duration faster:

public class func swipeLeftFast(element:XCUIElement)
{
    customSwipe(refElement: element, startCoord: CGVector(dx: 1, dy: 5), endCoord: CGVector(dx: -1, dy: 5))
}


public class func customSwipe(refElement:XCUIElement, startCoord:CGVector, endCoord:CGVector)
{
    let swipeStartPoint = refElement.coordinate(withNormalizedOffset: startCoord)
    let swipeEndPoint = refElement.coordinate(withNormalizedOffset: endCoord)
    swipeStartPoint.press(forDuration: 0.1, thenDragTo: swipeEndPoint)
}

      

However, this is even slower than the standard XCUIElement

swipe API. Is it possible to create faster sounds and how can I understand the vector values ​​used in the above code? I suppose they are not specific screen coordinates and if I set them, for example, to x:10, x:-10

accordingly, the swipes will be very slow, if I set them to x:0.1, x:-0.1

, the swipe will be too short to have any effect.

+3


source to share





All Articles