In my XCUITest tests, I expected to be able to scroll elements in iOS >= 15 devices (with X,Y deltas) since it’s declared in the header file as:
/**
* Scroll the view the specified pixels, x and y.
*/
@available(iOS 15.0, *)
open func scroll(byDeltaX deltaX: CGFloat, deltaY: CGFloat)
However, in the documentation website (https://developer.apple.com/documentation/xctest/xcuielement/1500758-scroll) it says under “Discussion”:
Available in macOS and in iPadOS 15 and later.
No iPhones :( Although it says nothing under “Availability”.
Calling this action when running on iPhone simulator, indeed raises the error message:
Pointer events are not supported for this device.
I’d expect this action to work on iOS as well, and not only on iPadOS. But sadly, as I mentioned, it isn't.
I made some workaround to make this "work" (partially), using XCUICoordinate
but I really don't like it (since it's impossible to find an hittable coordinate without guessing or using some messy heuristics that includes frames work) and would have been happy for something more elegant.
Is there any reasonable (elegant and accurate) alternative for this, that is scrolls based on X and Y deltas?