UI Testing execution stalls on "Wait for app to idle"

When executing the test suites I have, I see many times where the “wait for app to idle” stalls and will time out with the message “App animations complete notification not received, will attempt to continue.”


The code I used to make the test suites have zero customized code and most of it was generated via the recorder.


Example below:


t = 23.41s Find the "btn login" Button

t = 23.41s Snapshot accessibility hierarchy for com.testapp.mobilecordova

t = 24.44s Find: Descendants matching type NavigationBar

t = 24.44s Find: Elements matching predicate '"LOG IN" IN identifiers'

t = 24.44s Find: Descendants matching type Button

t = 24.44s Find: Elements matching predicate '"btn login" IN identifiers'

t = 24.45s Wait for app to idle

t = 24.95s Synthesize event

t = 25.22s Wait for app to idle

t = 147.39s App animations complete notification not received, will attempt to continue.

t = 147.39s Snapshot accessibility hierarchy for com.testapp.mobilecordova

t = 148.10s Find: Descendants matching type StaticText

t = 148.10s Find: Elements matching predicate '"PLEASE TURN ON NOTIFICATIONS" IN identifiers'

t = 148.10s Use cached accessibility hierarchy for com.testapp.mobilecordova

t = 148.10s Find: Descendants matching type CollectionView

t = 148.11s Find: Descendants matching type StaticText

t = 148.11s Find: Elements matching predicate '"3D Rooms Now Available!" IN identifiers'

t = 148.11s Use cached accessibility hierarchy for com.testapp.mobilecordova

t = 148.11s Find: Descendants matching type StaticText

t = 148.12s Find: Elements matching predicate '"DAILY" IN identifiers'

t = 148.17s Check predicate `exists == 1` against object `"HOME" StaticText`

t = 148.17s Snapshot accessibility hierarchy for com.testapp.mobilecordova

t = 148.62s Find: Descendants matching type NavigationBar

t = 148.62s Find: Elements matching predicate '"HOME" IN identifiers'

t = 148.62s Find: Descendants matching type StaticText

t = 148.62s Find: Elements matching predicate '"HOME" IN identifiers'

t = 148.62s Use cached accessibility hierarchy for com.testapp.mobilecordova

t = 148.63s Find: Descendants matching type NavigationBar

t = 148.63s Find: Elements matching predicate '"HOME" IN identifiers'

t = 148.63s Find: Descendants matching type StaticText

t = 148.63s Find: Elements matching predicate '"HOME" IN identifiers'

t = 148.63s Use cached accessibility hierarchy for com.testapp.mobilecordova

t = 148.64s Find: Descendants matching type Button

t = 148.64s Find: Elements matching predicate '"My Friends" IN identifiers'

t = 148.64s Tap "compose" Button

t = 148.64s Wait for app to idle

t = 269.48s App animations complete notification not received, will attempt to continue.

t = 269.48s Find the "compose" Button

t = 269.48s Snapshot accessibility hierarchy for com.testapp.mobilecordova

t = 269.96s Find: Descendants matching type CollectionView

t = 269.96s Find: Descendants matching type Button

t = 269.97s Find: Elements matching predicate '"compose" IN identifiers'

t = 269.97s Wait for app to idle

t = 391.80s App animations complete notification not received, will attempt to continue.

t = 391.80s Synthesize event

t = 392.12s Wait for app to idle



I have been searching for a way to modify this or add code to make it pass but have not been successful.


I tried disabling the animations and found that the tests no longer wait and tests fail 100% of the time.

In my case was because I had some animations (UIView.animate...) since the framework needs to wait for the app to be static. What I did was UIView.setAnimationsEnabled(false) when running the app from the UI tests (you can send launchArguments or something)

Excellent!

See also

[https://www.jessesquires.com/blog/2021/03/17/xcode-ui-testing-reliability-tips/)

UI Testing execution stalls on "Wait for app to idle"
 
 
Q