I'm facing with one problem using UITesting
framework for the xCode that Apple has introduced at WWDC 2015.
I have a UITableView and this table contains a lot of cells. Also I have a NSArray with cells titles - if cell title is contained in NSArray this cell should be tapped.
My problem is that I can't scroll table view for particular cell, because framework doesn't contain method for working with table views, only swipe gestures (down, up).
Maybe somebody knows how I can tap on particular cell in table view? Or how I can scroll table view for particular cell?
Because when I call tap()
method for cell which are not visible at screen - nothing happen.
Thanks in advance!
This worked for me:
XCUIElementQuery *tablesQuery = self.app.tables;
XCUIElementQuery *cellQuery = [tablesQuery.cells containingType:XCUIElementTypeStaticText
identifier:@"Work"];
XCUIElementQuery* cell = [cellQuery childrenMatchingType:XCUIElementTypeStaticText];
XCUIElement* cellElement = cell.element;
[cellElement tap];
For scrolling the table use:
XCUIElementQuery *tablesQuery = self.app.tables;
XCUIElement* table = tablesQuery.element;
[table swipeUp];