I am using Xcode 11 & iOS 13 as part of a workflow for a UITest, but when I engage with the keyboard for the first time, the following appears and disrupts the test by blocking the keyboard:
Calling code in UI test:
app.textFields.element(boundBy: 0).tap()
What the simulator shows:

Since this obstructs the keys, my test will then fail. However, the next time I run the test on the same simulator, it will work properly.
CodeBender's answer is nice and leads down the right path, but doesn't compile since continue is a reserved keyword in Swift. Plus it would be nice to wait a small amount of time for the keyboard to show up.
// Sometimes the Apple Keyboard shows some sort of "Swipe" tutorial. Dismiss it!
private func begoneSwipeTutorial(app: XCUIApplication) {
let continueButton = app.buttons["Continue"]
if continueButton.waitForExistence(timeout: 2.0) {
continueButton.tap()
}
}
// Then use like this
func inputTextWhatever(app: XCUIApplication, element: XCUIElement) {
element.tap()
begoneSwipeTutorial(app: app)
// Do whatever you need to do
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With