Skip to content

Commit

Permalink
FIX
Browse files Browse the repository at this point in the history
  • Loading branch information
bartekpacia committed Oct 14, 2022
1 parent 3f55810 commit 2e92d37
Showing 1 changed file with 9 additions and 20 deletions.
29 changes: 9 additions & 20 deletions AutomatorServer/ios/AutomatorServerUITests/Automator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,30 +110,19 @@ class Automator {
orPredicateWithSubpredicates: [textFieldPredicate, secureTextFieldPredicate]
)

let elements = app.descendants(matching: .any).matching(predicate).allElementsBoundByIndex
guard let element = self.waitForAnyElement(elements: elements, timeout: self.timeout) else {
throw PatrolError.viewNotExists("text field at index \(index) in app \(format: bundleId)")
let textFields = app.descendants(matching: .any).matching(predicate)
let textFieldCount = textFields.allElementsBoundByIndex.count
Logger.shared.i("found \(textFields.count) text fields")
guard index < textFieldCount else {
throw PatrolError.viewNotExists("text field at index \(index)")
}

element.firstMatch.forceTap()
element.firstMatch.typeText(data)

let textField = textFields.element(boundBy: index)
textField.forceTap()
textField.typeText(data)
}
}

// func enterText(_ data: String, by index: Int, inApp bundleId: String) async throws {
// try await runAction("entering text \(format: data) by index \(index)") {
// let app = try self.getApp(withBundleId: bundleId)
// let element = app.textFields.element(boundBy: index)
//
// let exists = element.waitForExistence(timeout: self.timeout)
// guard exists else {
// throw PatrolError.viewNotExists("text field at index \(index) in app \(format: bundleId)")
// }
//
// element.firstMatch.tap()
// element.firstMatch.typeText(data)
// }
// }

// MARK: Services

Expand Down

0 comments on commit 2e92d37

Please sign in to comment.