title: UI testing a tab bar controller
body: <p>I have built a simple tab bar with 3 tabs.  </p>
  
  <p><a href="https://i.stack.imgur.com/Ov7kM.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Ov7kM.png" alt="enter image description here"></a></p>
  
  <p>I want to run a UI test to make sure that if the user clicks a tab bar item, the correct view controller shows.  How would I go about doing that?  Below is the code I would start with, just don't know how to write my assertion.</p>
  
  <pre><code>func testTabBarMyProfileButton() {
      let tabBarsQuery = XCUIApplication().tabBars
      tabBarsQuery.buttons["My Profile"].tap()
  }
  
  func testTabBarGraphsButton() {
      let tabBarsQuery = XCUIApplication().tabBars
      tabBarsQuery.buttons["Graphs"].tap()
  }
  
  func testTabBarAboutButton() {
      let tabBarsQuery = XCUIApplication().tabBars
      tabBarsQuery.buttons["About"].tap()
  }
  </code></pre>