XCTestCase: Wait for app to idle

前端 未结 2 1432
故里飘歌
故里飘歌 2021-02-02 14:53

My UI-test fails because the test waits endless until the app idles. I can not see that there is anything happening in the background, like a loading spinner.

It just oc

2条回答
  •  醉梦人生
    2021-02-02 15:31

    let tabBarsQuery = self.app.tabBars
    let button = tabBarsQuery.buttons[@"Screen2"]
    

    while writing UI test cases, system taking time to make it hittable so we are creating a predicate for it and waiting for the button.

    let predicate = NSPredicate(format: "isHittable == 1") expectation(for: 
    predicate, evaluatedWith: button, handler: nil)
    waitForExpectations(timeout:10, handler: nil)
    button.tap()
    

提交回复
热议问题