title: Swift - How do you test whether a label has been updated when a button is tapped
body: <p>I've go a very simple calculator and I' trying to test whether a label gets updated when a button is tapped.</p>
  
  <p>My test method looks like this:</p>
  
  <pre><code>let app = XCUIApplication()
  app.buttons["9"].tap()
  </code></pre>
  
  <p>I can visually see the Label being updated but I'm not sure how to test it.</p>
  
  <p>I think I need to use <code>XCUIElementQuery</code> API to query label and then assert that the label text has changed. I'm just not sure how to do that.</p>
  
  <p>I'm not sure about the following questions:</p>
  
  <blockquote>
    <ul>
    <li>Do I need to know what the value is for the label to be able to query?</li>
    <li>Is there a way of querying for the label without knowing what the value is when the application starts?</li>
    </ul>
  </blockquote>