1
 let webViewsQuery = app.webViews
    let emailOrPhoneTextField = webViewsQuery/*@START_MENU_TOKEN@*/.textFields["Email or phone"]/*[[".otherElements[\"Sign in – Google accounts\"].textFields[\"Email or phone\"]",".textFields[\"Email or phone\"]"],[[[-1,1],[-1,0]]],[0]]@END_MENU_TOKEN@*/
    let exists = NSPredicate(format: "exists == TextField")
    expectation(for: exists, evaluatedWith: emailOrPhoneTextField, handler: nil)
    waitForExpectations(timeout: 30, handler: nil)
    emailOrPhoneTextField.tap()

Asynchronous wait failed: Exceeded timeout of 30 seconds, with unfulfilled expectations: "Expect predicate exists == 1 for object "Email or phone" TextField" when running through fastlane scan

2 Answers2

1

That's because you've never fulfilled your expectation (with expectation.fulfill() method). Use XCTWaiter if you don't care about expectation fulfilment.

  • 1
    expectation(for predicate:...) doesn't require .fulfill to be called - it's a special-case expectation which evaluates itself repeatedly when waitForExpectations is called, based on the outcome of the predicate. – Oletha Jul 04 '18 at 18:14
1

Is it not just that you need to make your expectation evaluate to true?

let exists = NSPredicate(format: "exists == true")

or

let exists = NSPredicate(format: "exists == 1")
alannichols
  • 1,496
  • 1
  • 10
  • 20