kuang
kuang

Reputation: 309

Cannot tap a table cell in Xcode UI testing

I am writing Xcode UI test cases for a tableview. My code (Objective-C) is something like this

XCUIElement *elementCell = app.cells[@"AccessibilityIdentifierOfTheCell"];
XCTAssertTrue(elementCell.exists); // this assert passed
[elementCell tap]; // !!!??? crashed here

The testing crashes at the "tap" method.

I also tried Xcode's "Recode UI Test" enter image description here to see how Xcode would catch the "tapping" behaviour in UI testing but, unfortunately, when I tapped on the cell the testing crashed as well and Xcode popped up this: enter image description here

I got stuck here for quite a while and it will be highly appreciated if anyone can help me out.

Upvotes: 1

Views: 457

Answers (1)

kuang
kuang

Reputation: 309

Right after the question was posted I went back and tried again and, weirdly, it worked. I changed nothing. It may be that Xcode UI testing functionality is not steady yet.

Sorry for that.

Upvotes: 1

Related Questions