【问题标题】:XCUI tests failed due to Asynchronous wait failed: Exceeded timeout of 30 seconds, with unfulfilled expectationsXCUI 测试因异步等待失败而失败:超过 30 秒的超时,未达到预期
【发布时间】:2018-07-04 03:52:35
【问题描述】:
 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()

异步等待失败:超过 30 秒的超时,未实现预期:“通过 fastlane 扫描运行时,预期谓词 exists == 1 用于对象“电子邮件或电话”TextField”

【问题讨论】:

    标签: xcode8 xcode-ui-testing fastlane xcuitest


    【解决方案1】:

    那是因为您从未实现过您的期望(使用expectation.fulfill() 方法)。如果您不关心期望的实现,请使用XCTWaiter

    【讨论】:

    • expectation(for predicate:...) 不需要调用 .fulfill - 它是一种特殊情况的期望,它在调用 waitForExpectations 时根据谓词的结果重复评估自身。
    【解决方案2】:

    不仅仅是你需要让你的期望评估为真吗?

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-12-30
      • 1970-01-01
      • 2022-11-03
      • 2011-10-20
      • 2017-05-08
      • 2021-12-31
      • 1970-01-01
      • 2016-03-04
      相关资源
      最近更新 更多