title: How to wait in a XCTest for T seconds without timeout error?
body: <p>I want to delay progression of a test for T seconds, without generating a timeout.</p>
  
  <p>First I tried the obvious:</p>
  
  <pre><code>sleep(5)
  XCTAssert(&lt;test if state is correct after this delay&gt;)
  </code></pre>
  
  <p>But that failed.</p>
  
  <p>Then I tried: </p>
  
  <pre><code>let promise = expectation(description: "Just wait 5 seconds")
  waitForExpectations(timeout: 5) { (error) in
      promise.fulfill()
  
      XCTAssert(&lt;test if state is correct after this delay&gt;)
  }
  </code></pre>
  
  <p>My <code>XCTAssert()</code> now succeeded.  But <code>waitForExpectations()</code> failed with a timeout.</p>
  
  <p>This is according to the documentation of <a href="https://developer.apple.com/documentation/xctest/xctestcase/1500748-waitforexpectations" rel="noreferrer"><code>XCTest</code> wait functions</a> saying:</p>
  
  <blockquote>
    <p>Timeout is always treated as a test failure.</p>
  </blockquote>
  
  <p>What are my options?</p>