"App failed to quiesce within 60s"in React-Native project
Asked Answered
R

1

6

So I'm attempting to run an XCode UI Test on my React Native project. My goal is to use fastlane/snapshot to grab screenshots of my app.

I finally figured out how to script my app to do what I want. Unfortunately, the app gets stuck with an App failed to quiesce within 60s message after calling app.otherElements["mainButton"].tap().

As far as I can tell as a human, my app appears to be static and not updating or animating anything. But I'm not clear what the UI Test is using for its detection heuristic, so it might be using some internal state or checking threads.

I suspect there's some React Native behavior that's keeping the UI Test from seeing things as finished. Unfortunately, without any real ability to see what UI Tests are doing, I'm not even sure where I need to dig into React Native to fix it. :(

Any help would be appreciated!

Recipient answered 5/8, 2016 at 4:28 Comment(1)
M
1

The workaround from link above For the view having issues and a line to disable animations in

viewWillAppear:
- (void) viewWillAppear: (BOOL)animated {  
    if ([[[NSProcessInfo processInfo] environment][@"UITEST_DISABLE_ANIMATIONS"] isEqualToString:@"YES"]) {  
        [UIView setAnimationsEnabled:NO];  
    }  
}  

and in viewWillDisappear turn animations back on:

- (void) viewWillDisappear:(BOOL)animated {  
    if ([[[NSProcessInfo processInfo] environment][@"UITEST_DISABLE_ANIMATIONS"] isEqualToString:@"YES"]) {  
        [UIView setAnimationsEnabled:YES];  
    }  
}  

In your tests extend XCUIApplication and set variables. Then in your setup method call that launchvariables function

extension XCUIApplication {  
    func launchTestsWithEnvironmentVariables() {  
             launchEnvironment = [  
                 "UITEST_DISABLE_ANIMATIONS" : "YES"  
             ]  
     self.launch()  
    }  
}  




 override func setUp() {  
        super.setUp()  
        continueAfterFailure = false  
        XCUIApplication().launchTestsWithEnvironmentVariables()  
    }  




func testblahblah {  

This sets an environmental variable that will disable animations for that particualr view. Only downside is you won't be testing animations for that view if thats something your into. Hacky workaround but it works for now.

PS it really helped for me

Milore answered 4/9, 2016 at 14:22 Comment(1)
Awesome, thank you so much! I didn't have a UIViewController subclass to stick them in (since I use a stock UIViewController in AppDelegate.m). I did however stick the disabling-code inside my AppDelegate's didFinishLaunchingWithOptions, which worked well for me. (Disabled them for the duration of the app run, since I didn't have any reason to re-enable them for other views)Recipient

© 2022 - 2024 — McMap. All rights reserved.