2

I'm trying to convert the following block of code to Quick/Nimble with no success whatsoever

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

I tried the following but the test does not pass

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

Thx in advance for your help!

Nikolai
  • 256
  • 2
  • 13

2 Answers2

3

I think "toEventually" is what you are looking for. Here is the example:

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

More to check here: https://github.com/Quick/Nimble#asynchronous-expectations

Mikhail Glotov
  • 336
  • 3
  • 9
3

You can also set the timeout globally, e.g. once your tests start, so it applies for all toEventually calls:

Nimble >= 9.0.0

Nimble.AsyncDefaults.timeout = .seconds(2)

Nimble < 9.0.0

Nimble.AsyncDefaults.Timeout = 2
blackjacx
  • 9,011
  • 7
  • 45
  • 56