Reputation: 4886
I have a tableview that I want to run through a UI Test, but there is a problem.
When I have a tableview with 10000 rows, the UI Test will refuse to tap the row and will fail
// Testing code
XCUIApplication().tables.cells.element(boundBy: 0).tap()
The project is quite simple. When you tap the row, a view controller is presented. This doesn't seem to work in a UI Test in Xcode.
Has anyone run in to this issue? How have you gotten around it?
I am using Xcode 8.3.2.
I have a sample project that replicates this issue in the UI Test. https://github.com/wh1pch81n/UI_test_tableView
Upvotes: 0
Views: 820
Reputation: 301
The issue is already discussed in the Apple thread UI Testing: Failed to get refreshed snapshot, look for jamhughes, response.
The main issue is the sheer number of rows being loaded. If we try to load a handful of cells at a time, XCUI Scripts work. I tried the sample project posted and was able to the see the scripts passing for 3000 rows. beyond which the scripts fail with "Failed to get refreshed snapshot within 15s".
Unfortunately, The only workaround here is to limit the number of rows being loaded at one short. You can also find a similar issue with pickers too here failed-to-get-refreshed-snapshot-error-when-ui-testing-with-a-uipickerview.
Upvotes: 3