Herno
Herno

Reputation: 1597

How to write UI tests using XCUITest framework for large tableviews in UIKit app

I am trying to write a UI automation test for my iOS app using XCUITest framework.

My app has a screen with a UITableView that has a datasource which can have over 3000 rows.

My UI tests are getting stuck when trying to either find elements on this screen or even when trying to tap on buttons.

Example of usages:

app.cells.element(boundBy: 0).firstMatch.exists

or

app.buttons["FilterButton"].firstMatch.tap()

Upon inspecting the main app process, I notice the app is stuck in an really long process of iterating the whole 3000+ rows one by one and calling the tableView method:

func tableView(_ tableView: UITableView, cellForRowAt cellIndexPath: IndexPath) -> UITableViewCell

Is there a way to avoid XCUITest to scanning the entire list of cells in the tableView?

Note: the firstMatch property is supposed to be used to avoid this long hiearchy queries, but this does not work when trying to use tap for example. As XCUI engine starts scanning the whole tableView trying to see if the button has no interrupting elements on top of it.

Upvotes: 2

Views: 113

Answers (0)

Related Questions