Repeating animations cause UI tests to hang, and ultimately fail

Originator:johnhammerlund
Number:rdar://25562105 Date Originated:4/5/16
Status:Open Resolved:
Product:iOS SDK Product Version:9.3
Classification: Reproducible:Always
 
Summary:
When there are active animations on any views within the main window hierarchy, the test framework determines that the application isn't idled. For repeating animations, this means that the test framework will hang until it hits a timeout and fail with "App failed to quiesce within 60s"

Steps to Reproduce:
1. Start a new single-view iOS application project in Xcode with UI Testing enabled
2. Add a button and an additional view to the View Controller nib in Main.storyboard and wire IBOutlets to ViewController.m (we'll call them "button" and "animatingView"
3. In ViewController.m, modify viewDidLoad:

override func viewDidLoad() {
    super.viewDidLoad()
        
    UIView.animateWithDuration(1,
                               delay: 0,
                               options: [.CurveEaseInOut, .Autoreverse, .Repeat],
                               animations: {
        self.animatingView.alpha = 0
        }, completion: nil)
}

4. In the provided sample UI test file, add a dummy test:

func testThatFailsDueToRepeatingAnimation() {
    XCUIApplication().buttons.elementBoundByIndex(0).tap()
}

5. Run the test. Notice that the test fails with the following log:

UI Testing Failure - App failed to quiesce within 60s

6. Remove the .Repeat option from the animation code in ViewController.m
7. Re-run the test. Notice that it passes after the animation completes.

Expected Results:
Repeating animations are ignored, or XCTest provides functionality to do so

Actual Results:
Repeating animations cause tests to hang, and eventually fail

Version:
9.3 (13E234)

Configuration:
iPhone 6S 64GB AT&T, using LTE

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!