3

Looks like EarlGrey can't use nice function of waiting APP to idle when testing our APP. Getting this error on each screen:

EarlGrey tried waiting for 5.0 seconds for the application to reach an idle state, but it didn't. EarlGrey is now forced to cleanup the state tracker because the test -[EGT testLogin] might have caused the UI thread to be in a non-idle state indefinitely

Now I disabled the function and all work fine but can't understand what could be the reason of such problems. I had same problems on Xcode 7 UI automation but only on 1 screen from entire APP (because of some massive data fetchers) and not on the welcome page.

Here is the state AppStateTracker:

Waiting for a draw/layout pass to complete
Waiting for root UIViewController to appear
  • Seems to me that when the test ends, something leaves the app in a non-idle state. When this happens, could you please print out [GREYAppStateTracker sharedInstance]'s description and paste the results as part of your question? – khandpur Mar 04 '16 at 22:37
  • Added po in description. But what happened on my APP is not fail in the end of the test, but right from the start – Serghei Lungu Mar 04 '16 at 23:32
  • I see `Waiting for root UIViewController to appear`. There should be a call stack of what actually caused the app to be in that state. It should come from a viewWillAppear call. My guess is that there's unbalanced viewDidAppear call and it can happen when your subclass of UIViewController fails to call [super viewDidAppear:animated]; See https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/#//apple_ref/occ/instm/UIViewController/viewDidAppear:, more specifically where it says **"you must call super at some point in your implementation."** – khandpur Mar 05 '16 at 01:44
  • Were you able to figure it out? – khandpur Mar 07 '16 at 20:55
  • I see [super viewDidAppear:animated] in all of viewDidAppear methods. But as I see now - viewDidAppear is not firing on login and first pages. – Serghei Lungu Mar 09 '16 at 08:48
  • Do you expect it to fire? If not and you have identified a valid case where it won't you might want to file a bug against EarlGrey with that valid scenario. – khandpur Mar 09 '16 at 17:46

1 Answers1

5

If you have an animation that does not end (eg. a loading animation) your app will never be idle, so for that you would have to remove the animation or have it stop after a period of time

If the animation does stop, then you can use the information in the FAQ under How should I handle animations? to fix your problem.

Rudolf Adamkovič
  • 31,030
  • 13
  • 103
  • 118
trevren11
  • 192
  • 1
  • 4
  • 10