Switch the CI to code 14 and the iOS 14 simulator, fix UI tests

This commit is contained in:
Stefan Ceriu
2022-10-26 13:27:26 +03:00
committed by Stefan Ceriu
parent 8334fa1e69
commit 7daa4f121e
8 changed files with 113 additions and 72 deletions
@@ -20,16 +20,33 @@ import XCTest
extension XCUIApplication {
func goToScreenWithIdentifier(_ identifier: String) {
// Search for the screen identifier
textFields["searchQueryTextField"].tap()
typeText(identifier)
let textField = textFields["searchQueryTextField"]
let button = buttons[identifier]
let footer = staticTexts["footerText"]
while !button.isHittable, !footer.isHittable {
tables.firstMatch.swipeUp()
// Sometimes the search gets stuck without showing any results. Try to nudge it along
for _ in 0...10 {
textField.clearAndTypeText(identifier)
if button.exists {
break
}
}
button.tap()
}
}
private extension XCUIElement {
func clearAndTypeText(_ text: String) {
guard let stringValue = value as? String else {
XCTFail("Tried to clear and type text into a non string value")
return
}
tap()
let deleteString = String(repeating: XCUIKeyboardKey.delete.rawValue, count: stringValue.count)
typeText(deleteString)
typeText(text)
}
}