Search code examples
iosswiftswift3xctest

swipeUp() on XCUIApplication breaks the XCUIApplication in UITest


We got a test where we need to swipeUp to see a cell inside of a tableView. After the swipeUp we cant event print out the app.tables. If we do not swipe everything works as expected.

  • So what has changed in Swift 3 compared to Swift 2 here?
  • How do we fix that issue?

Example:

func testSomethingInApp() {
   let app = XCUIApplication()
   app.launch()
   app.swipeUp() //after this we cant get app.tables anymore. Befor everything is fine
   XCTAssertEqual(app.tables.cells.elementBoundByIndex(5), "something") //something like this
}

Solution

  • Xcode 9 and Swift 4.0 does fix this issue. app.swipeUp() doesn't clear the tableview queried elements anymore.