mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-05-03 22:56:57 +02:00
tests completed
This commit is contained in:
@@ -18,16 +18,21 @@ import Foundation
|
||||
import XCTest
|
||||
|
||||
extension XCUIApplication {
|
||||
func goToScreenWithIdentifier(_ identifier: String) {
|
||||
func goToScreenWithIdentifier(_ identifier: String, shouldUseSlowTyping: Bool = false) {
|
||||
// Search for the screen identifier
|
||||
let textField = textFields["searchQueryTextField"]
|
||||
let button = buttons[identifier]
|
||||
|
||||
// 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
|
||||
// This always fixes the stuck search issue, but makes the typing slower
|
||||
if shouldUseSlowTyping {
|
||||
textField.typeSlowly(identifier)
|
||||
} else {
|
||||
// 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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +40,7 @@ extension XCUIApplication {
|
||||
}
|
||||
}
|
||||
|
||||
private extension XCUIElement {
|
||||
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")
|
||||
@@ -49,4 +54,9 @@ private extension XCUIElement {
|
||||
typeText(deleteString)
|
||||
typeText(text)
|
||||
}
|
||||
|
||||
func typeSlowly(_ text: String) {
|
||||
tap()
|
||||
text.forEach{ typeText(String($0)) }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user