开发者社区 问答 正文

快速/灵活-等待谓词匹配

我试图将以下代码块转换为快速/灵活,但没有任何成功

XCTWaiter().wait(for: [XCTNSPredicateExpectation(predicate: NSPredicate(format: "height == 0"), 
                                                 object: vc.myView.frame)], 
                 timeout: 1)

我试过以下方法,但测试没有通过

waitUntil(timeout: 2) { done in
    expect(vc.myView.frame.height).to(equal(0))
    done()
}

提前感谢您的帮助!

展开
收起
游客5akardh5cojhg 2019-12-05 22:29:06 400 分享 版权
1 条回答
写回答
取消 提交回答
  • 我认为“最终”是你想要的。下面是一个例子:

    expect(vc.myView.frame.height).toEventually(equal(0), timeout: 2)
    
    

    这里有更多要检查的地方:https://github.com/Quick/Nimble#asynchronous-expectations

    2019-12-05 22:29:44
    赞同 展开评论
问答地址: