简体   繁体   English

如何修复在 XCUITest 中等待应用空闲的问题

[英]How to fix wait for app to idle in XCUITest

In my UI test, I sometimes get the Wait for app to idle message in the console.在我的 UI 测试中,我有时会在控制台中收到Wait for app to idle消息。 Usually, it's not that often, but now, it always appears and makes the test fails on my mac.通常,它不是那么频繁,但现在,它总是出现并使我的 Mac 上的测试失败。 This is what I have done so far:这是我到目前为止所做的:

  1. Disabling/enabling animation didn't work禁用/启用 animation 不起作用
  2. Disabling XCLogger that is used to log to a file didn't work禁用用于记录文件的 XCLogger 不起作用
  3. Disabling IQKeyboardManager didn't work禁用 IQKeyboardManager 不起作用

How do you get a trace of the main thread in UITest to see what's holding it?你如何在 UITest 中获取主线程的踪迹以查看它持有的是什么? How do I fix this?我该如何解决? Thanks.谢谢。

Sorry guys, it's my mistake.对不起各位,是我的错。 I have made helper functions to simplify tapping, inserting a string to a textfield, assert for existence, assert for non existence, etc. And at the start of each of those functions, I've added app.activate() to make sure the app is active.我制作了辅助函数来简化点击、将字符串插入文本字段、断言存在、断言不存在等。在每个函数的开头,我添加了app.activate()以确保应用程序处于活动状态。 So, it happened because I am too cautious.所以,它发生了,因为我太谨慎了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM