4

Since xCode updated i'm having trouble running any ui test case. It gives me this error when its expected to do a simple tapping action for example:

 XCUIApplication *app = [[XCUIApplication alloc] init];
  XCUIElement *passwordSecureTextField = app.secureTextFields[@"Password"];
  [passwordSecureTextField tap];

Anyone have any ideas why am i getting this error? I've searched on google and here but haven't found any solutions.

Thank you.

CodeGeass
  • 619
  • 2
  • 7
  • 20
  • If you look at the logs of the test, it should tell you exactly what line it got stuck on. Can you find out which line? My guess is that your `app.secureTextFields[@"Password]` query is getting stuck. – Etienne Oct 21 '15 at 19:07
  • Exactly that line is getting stuck, but i only get that error..where do i see any relevant information? – CodeGeass Oct 23 '15 at 10:41
  • If you press CMD+8 when in xCode it will open a left side panel with your build history. Expand the test run that failed and all the information you need should be there. Hope it helps. – Etienne Nov 03 '15 at 16:25
  • Well that doesn't help at all, it just prints the same error in there with no additional information what i found is this though: the element responds to is visible with true, and with is hittable with false..which i don't get how that works? – CodeGeass Nov 06 '15 at 18:52
  • 1
    are u sure that ui main thread is not busy? For me, i got this error when I was doing autoreverse animation in the main thread. I disabled it for testing and UI Test runs successfully – Wael Showair Feb 01 '16 at 09:03

5 Answers5

2

Make sure you don't have any animations on screen during UI Automation tests. We had a text alert flashing on the login screen for debug/test builds of our app, and it would cause the "failed to quiesce" error until it was removed.

There are some other posts about this error that mention issues with UIRefreshControl, so I would suspect animating that or UIActivityIndicatorView would cause the same problem.

Anthony F
  • 6,096
  • 4
  • 31
  • 32
0

It might help to turn on the "All Exceptions" breakpoint. I used it and I recall getting the same error. It will break at the line with the problematic code and should show you the stack trace of the error with more info.

Narine Cholakian
  • 189
  • 1
  • 2
  • 13
0

I had a similar error - as well as the simulator running very slowly. In my case it was fixed very simply by the method given in the accepted answer here: Xcode simulator extremely slow.

To save you a click: The issue was that I had accidentally pressed Cmd + T at some point, enabling "Slow animations".

Community
  • 1
  • 1
ChidG
  • 3,053
  • 1
  • 21
  • 26
0

I had to turn off the "Personal Hotspot" in order to get a working test environment (Because the blue bar in the top apparently disturbed XCTestRunner) But as some tests need internet connection I can't do testing when being in the wild:-(

Leo
  • 925
  • 10
  • 24
0

Anthony F's answer says it all. Likely something is still animating. The system seems to wait for the app UI to "settle" (go idle) and when that happens, it performs the tap action. However, when the UI constantly runs animations, it will never settle.

Xcode Console Output

Enable the console output in Xcode to see what happens when running the test.

Below is an example of the log, when it works well. The system waits for the app to go idle and when that has happened, it goes to find the button in the hierarchy.

t =    16.95s     Tap "@go" Button
t =    16.95s         Wait for app to idle
t =    17.00s         Find the "@go" Button
t =    17.00s             Snapshot accessibility hierarchy for XXX
t =    17.09s             Find: Descendants matching type Button
t =    17.09s             Find: Elements matching predicate '"@go" IN identifiers'
t =    17.10s             Wait for app to idle
t =    17.15s         Synthesize event
t =    17.41s         Wait for app to idle

Below is an example when it fails. The system waits for the app to settle so that it can look for the button in the hierarchy. Since, it does not settle, it waits "forever" finally running into the timeout.

t =    18.88s     Set device orientation to Unknown
t =    18.93s     Tap "@go" Button
t =    18.93s         Wait for app to idle
t =    79.00s             Assertion Failure: UI Testing Failure - App failed to quiesce within 60s

In my case the "failed to quiesce" was caused, because at time t=18.90s, demo data was generated which caused repeated updates of a UIProgressView. From then on the app UI never settled ("quiesced").

("quiesce" as a word is not in my active vocabulary, which certainly has delayed my recognition of what was going on. The console output pushed me into the right direction. I'd bet "idle" rings more bells than "quiesce" for many developers.)

Rainer Schwarze
  • 4,725
  • 1
  • 27
  • 49