I am using XCUITest for UI-based testing of an iOS app.
A major (almost showstopping) problem in the project is performance when searching for elements in the visual tree.
Exemplification:
Front-screen of app consists of a stack of horizontal sliders containing about 20 views each. Each of these (slider) child views are itself a complex view with a deep hierarchy.
At the top of all this there is a button or two which must be tapped as part of the test.
When app is loading and sliders are not populated yes, it takes about 2-4 seconds to search and get an XCUIElement to a button in the screen's top. When app is finish loading and all sliders are populated, it takes a minut. BIG PROBLEM.
Therefore, I am convinced that it is the amount of elements in the visual tree that slows down the process.
I have tried a lot of different approaches to speed up the search, but all in vain.
What have been tried:
- Normal approach like: app.buttons["name of button"].tap()
- Same as 1, but get XUIElement before app loads
- Use XCUIXoordinates