title: How to use expectationForNotification
body: <p>I've tried everything, but the only way I could get a successful test is to actually send the notification in the test function, which kinda defeats the purpose.</p>
  
  <p>I have a button.  When I tap the button, it sends a notification.  How can I use expectationForNotification to see if this notification gets sent?</p>
  
  <pre><code>func testExample() {
      let app = XCUIApplication()
      let button = app.buttons["Button"]
      let expectation = expectationForNotification("TEST_NOTE", object: nil) {
          (notification: NSNotification!) -&gt; Bool in
  
          print("SUCCESS")
          return true
      }
  
      button.tap()
  
      waitForExpectationsWithTimeout(5, handler: nil)
  }
  </code></pre>