As of Xcode 13.3 and iOS 15.4, the keyboard onboarding screen does not count as an interruption by the XCTest framework and does not trigger a call to the interruption handler closure of addUIInterruptionMonitor(withDescription:handler:)
.
I created this convenient function that taps a keyboard key while also handling the keyboard onboarding screen. It should minimize the chances of failing a test that interacts with the keyboard.
extension XCUIApplication {
/// Taps the specified keyboard key while handling the
/// keyboard onboarding interruption, if it exists.
/// - Parameter key: The keyboard key to tap.
func tapKeyboardKey(_ key: String) {
let key = self.keyboards.buttons[key]
if key.isHittable == false {
// Attempt to find and tap the Continue button
// of the keyboard onboarding screen.
self.buttons["Continue"].tap()
}
key.tap()
}
}