ios - 无法监视事件循环并等待应用程序空闲

标签 ios xcode xctest xctestcase

我正在使用 XCTest 为我的应用编写 UITest 用例。该应用程序在主屏幕上进行了多次服务器调用。我无法导航到下一个屏幕。自动化经常闲置 1 分钟,甚至超过消息的闲置时间

Wait for the app to idle

Unable to monitor event loop

有没有办法让应用程序执行我的测试用例来打破这个???

最佳答案

我在 UI 测试类中设置了参数

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

在我的 Appdelegate 的 didFinishLaunchingWithOptions 方法中我进行了检查

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

所以现在在我的应用程序中,不会有任何动画,我的应用程序也不会再被阻止。这将我的自动化时间从 25 分钟减少到 2 分钟。

关于ios - 无法监视事件循环并等待应用程序空闲,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40156203/

相关文章:

ios - 将 iOS 项目部署目标从 8 降级到 7

ios - 使用APNS发送远程推送通知的送达报告-IOS

xcode - 使用多个 UIBezierPaths 绘制性能

ios - swift 2 : Cannot invoke 'addAnnotation'

xcode - 断言 UITest 中的按钮上存在图像

iphone - 增加标签栏项目之一的高度

ios - 动态 TableViewCell 高度以适合下载的图像

ios - CorePlot/iOS 7.1/XCode 5.1 更新到 XCode 5.1 后构建失败

ios - 在Simulator上的iOS应用中,启动OS X Shell脚本

ios - XCTest 中的 performTaskWithPathArgumentsTimeout?