Reputation: 7
I have function for scrolling used in my UiTests. Here it is
func scroll(_ elementQuery: XCUIElement, to toElementQuery: XCUIElement, direction: Direction, swipesCount: Int) {
var swipe = 0
let swipeClosure: () -> Void = {
switch direction {
case .up: elementQuery.swipeUp()
case .left: elementQuery.swipeLeft()
case .right: elementQuery.swipeRight()
case .down: elementQuery.swipeDown()
}
swipe += 1
}
while !toElementQuery.exists && swipe <= swipesCount {
swipeClosure()
}
if toElementQuery.exists {
let elementHittable = toElementQuery.isHittable
while !toElementQuery.isHittable && swipe <= swipesCount {
swipeClosure()
}
}
if !toElementQuery.exists {
XCTFail(errorMessage)
} else if !toElementQuery.isHittable {
XCTFail(errorMessage)
}
When I use it on iOS 15 simulators it works great. But after downloading Xcode 14 and iOS 16 simulator
toElementQuery.isHittable started to return false, even if tap() working great with this element.
When I use simulator < 16 iOS toElementQuery.isHittable returns true
Upvotes: 0
Views: 233
Reputation: 209
isHittable
returns true if the element has a size and is not blocked by any other iOS accessibility element.
Has the display of your app changed between the 2 iOS versions?
It could be helpful to add the debugDescription
of your XCUIApplication on both iOS versions to help debug this issue.
Upvotes: 0