我正在使用 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/