I have filed a feedback report here: https://feedbackassistant.apple.com/feedback/11413188 – thanks for looking into this!
Post
Replies
Boosts
Views
Activity
This is the screenshot for iOS 16:
This is the screenshot for iOS 15.5:
We have run into a similar problem and it still seems to be the case in Xcode 14 beta 4. In our case, we rely heavily on screen coordinates for testing. It seems that on iOS 16 devices only, XCUITest is returning pixels instead of points. In other words, the coordinates are multiplied by the scale of the device screen. For example, I ran the same UI test on Xcode 14 beta 3 (and 4) against two iPhone 11 simulator devices, one using iOS 15.5, the other using iOS 16.0. Here is the relevant part of the test:
func testExample() throws {
let app = XCUIApplication()
app.launch()
let button = app.tabBars["Tab Bar"].buttons["Debug"]
let location = button.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).screenPoint
print("Button location: \(location)")
}
On iOS 15.5, this prints: Button location: (207.0, 838.0)
On iOS 16.0, this prints: Button location: (414.0, 1676.0)
If this is an intentional change on Apple’s part, they need to say so in the release notes.
I’ve just verified that it still happens with Xcode 13.4.