iosxcodexctestxctestcase

Unable to monitor event loop AND Wait for app to idle


I am writing UITest cases for my app using XCTest. The app makes several server calls on the home screen. I could not navigate to the next screen. Automation often stays idle for 1 min or even more than that with the message

Wait for the app to idle

or

Unable to monitor event loop

Is there a way to make the app execute my test cases breaking this ???


Solution

  • I have set argument in UI test class

    let app = XCUIApplication()
    app.launchArguments = ["NoAnimations"]
    app.launch()
    

    In my Appdelegate's didFinishLaunchingWithOptions method I made a check

     NSArray *args = [NSProcessInfo processInfo].arguments;
        
        for (NSString *arg in args){
            if ([arg isEqualToString:@"NoAnimations"]){
                [UIView setAnimationsEnabled:false];
            }
        }
    

    So now all over my app, there won't be any animation and my app is no more blocked. This reduced my automation time from 25mins to 2mins.