Xcode 9.3 UI testing super slow?

I have an integration bot performing a simple set of UI tests which exercise basic functionality of my app on a scheduled basis. One part of this is to query the table view and count on-screen cells of a specific accesibilityIdentifier pattern. A scroll of the table view is performed, and a new count of on-screen cells is performed.


I'm encountering two new problems with Xcode 9.3

  1. The tests take a huge amount of time. I've seen it perform a full set of passed tests in 2 hours, and other tests run for 4 or 5 hours before completing. In the past, the tests took 1 hr 15 minutes very very consistently (give or take 5 minutes). Now it takes 2 hrs minimum and up to 5 hours. Very strange
  2. Please look at this simple code...
let tableView = (my routine for finding a specific table view in question)
let searchPredicate = NSPredicate(format:predicateString)
let allCells = tableView?.cells.otherElements.matching(searchPredicate).allElementsBoundByIndex
           
sleep(5) //I've often found that a sleep is needed to give the system time to reify reused objects; am I wrong?
allCells?.forEach { oneCell in
     if oneCell.exists {
          let isHittable = oneCell.isHittable

On most, but not every, run at least one simulator reports a failed test assertion: "Failed to determine hittability of <my cell identifier> Other: Error copying attributes -25202". How can I reliably check if a cell isHittable without running into this trouble? How can it pass the existence test but fail to be queryable for isHittable?

Replies

I am having the same issue in Xcode 9.4.1 Sometimes the test runs very well but sometimes even if the element is seen on the screen xcuitest throws that error. I tried to add sleep, it didnt work Tried adding [waitForExistence withTimeout] still it gives me that error. This has been a long going issue in Xcode. Don’t know when apple willl take care of this. :(