Search code examples
iostestingfunctional-testingearlgrey

How do I debug timeout failures in EarlGrey tests?


Every time I run my EarlGrey test, it fails with the following message:

Failed to change device orientation due to error: Error Domain=com.google.earlgrey.GREYUIThreadExecutorErrorDomain Code=0 "Failed to execute block because App is not idle. Perhaps an animation or network request is ongoing for an indefinite period of time? Waiting for terminal events gives me an issue. Full state transition call stack for all elements:

<RootViewController:0x7ff40a846e50> => Waiting for UIViews to appear

Solution

  • This can happen when methods used to manage the appearance and disappearance of views aren’t invoked correctly, or in the right order. Look at the state transition stack traces in the timeout failure message to see the state of each view controller. You can use this information to determine which view controller is overriding the viewWillAppear or viewDidAppear methods, but missing the call to super call. EarlGrey uses view lifecycle calls to track the state of the app for synchronization purposes.