Hold is not working on `press(forDuration:thenDragTo:withVelocity:thenHoldForDuration:)`

I'm trying to use this API in my UITest suite: https://developer.apple.com/documentation/xctest/xcuicoordinate/3551692-press

press(forDuration:thenDragTo:withVelocity:thenHoldForDuration:)

However, the holdDuration parameter has no affect and the action stops once the drag is finished (instead of keep holding the element).

I've reproduced this error with a demo application, along with a reproductive UI test and videos:

https://github.com/asafkorem/XCUITestHoldBugReproduction

Also, I do not find any reasonable workaround for the problem.

Thanks.

Hello!

I checked out your code to see if there is an issue here.

It seems that you change the label to "Success!" in a pan gesture recognizer:

  @objc private func panned(_ sender: UIPanGestureRecognizer) {

Although a pan gesture recognizer is continuous, it seems to only be called when a finger moves. In the UI test, the finger at the end is held perfectly still, so the pan gesture recognizer is never triggered after the 1 second hold elapses.

To make this work, you would probably need to add a polling timer between touch down and touch up, as opposed to a gesture recognizer, so that touches that remain perfectly still are detected and your label changes to "Success!"

As far as I could tell, there is no bug in XCUITest here.

Thank you for checking my code! I will check your suggestion.

Hold is not working on `press(forDuration:thenDragTo:withVelocity:thenHoldForDuration:)`
 
 
Q