Thank you so much for this! I was stuck on this failure happening in Xcode Cloud only with this function:
func hideKeyboardIfExists(app: XCUIApplication) {
if app.keyboards.element(boundBy: 0).exists {
app.keyboards.buttons["Hide keyboard"].tap()
}
}
For some reason, the test would fail with "Checking existence of Keyboard (Element at index 0)
" and then retry 1 and retry 2 at 30 second intervals which was very mysterious. The keyboard was on screen according to the simulator replay, so it's strange that it would fail to find it, and also strange that it would get stuck in a retry loop instead of simply skipping the if
clause.
Based on this post, I downgraded the Xcode Cloud workflow to Ventura 13.6.3 and Xcode 14.3.1 and then the simulator to iOS 16.4. (The error was occurring with Xcode Cloud workflow specifying Sonoma 14.1.2, Xcode 15.2 and simulator iOS 17.2.) And voila that error is gone! How come Apple hasn't fixed this yet?