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.
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
}
Try to access your element directly... app.staticText["something"]
When I wrote my UITests, I had some issues like these. I searched for the elements, putting breakpoints, and reading the output.
Print app
in console using po app
command.
Read the output, search for the element you want, see its type (if is a staticText, button, otherElements, whatever...)
See that all the elements available are displayed in output. The first word of each line in output is the type of each element.
In your code, access the type using: app.buttons
to buttons, app.staticTexts
to labels, etc...
JLU
Xcode 9 and Swift 4.0 does fix this issue. app.swipeUp()
doesn't clear the tableview queried elements anymore.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With