I was working on a basic iOS tutorial app and thought I could also start learning some EarlGrey
with it. The test that I'm automating has this flow -
I have a large UITableView and I pre-populate it with some random words that I generate. These can be quite long and I might have over 100 cells in my TableView.
In my test, I randomly select one of the words generated and search for it within the cell. Each cell has the following UI:
| | | |Word| |Word-Count| | UIImage | | | |
So in EarlGrey
-
- (void)setup {
[super setup];
GeneratorClass dataSource =
[[GeneratorClass alloc] initWithRandomData];
self.tableView.dataSource = dataSource;
_randomSelectedValue = dataSource.randomValue;
}
- (void)testTableElementVisible {
id<GREYMatcher> *cellMatcher = grey_allOf(grey_minimumVisiblePercent(0.0f),
grey_interactable(),
grey_isKindOfClass([UITableViewCell class]),
grey_text(_randomSelectedValue), nil);
[[EarlGrey selectElementWithMatcher:cellMatcher]
asserWithMatcher:grey_sufficientlyVisible()];
[[EarlGrey selectElementWithMatcher:cellMatcher]
performAction:grey_tap()];
}
However, on Jenkins, this test takes quite long to run and fails with "Timeout (currently set to 30) occurred when looking for elements."
The screen is frozen and though locally I can see the tap occur, I haven't been able to have it pass on it. Is there any way by which I can speed this test up or is there something wrong that I'm doing here that's causing EarlGrey to freeze?