ios - Bitrise 测试(有些一致,有些不一致)失败并出现 "AX action"错误

标签 ios xcode-ui-testing bitrise

我在 XCUITest 框架中为一个相当重要的应用程序编写了许多测试(该应用程序的存在时间比我在这家公司的时间长了几年)。所有测试在我的笔记本电脑以及其他工程师的笔记本电脑上一致通过。

在 Bitrise 上运行测试时,第一个 UI 测试每次在设置阶段都会失败,并显示以下消息:

testFixtureAttachment, UI Testing Failure - Failed to perform AX action for monitoring the animations of (app), error: Error -25204 performing AXAction 2043

其他测试通常会通过,但有时会失败,并出现以下错误:

UI Testing Failure - Failed to perform AX action for monitoring the event loop of (app), error: Error -25204 performing AXAction 2042

UI Testing Failure - Failed to scroll to visible (by AX action) TextField 0x7fe800f9fa20: traits: ... error: Error -25204 performing AXAction 2003

如何解决此问题,以便至少让我的第一次测试在设置时不会总是失败?

最佳答案

根据 XCUITest 团队的反馈,发生这种情况是因为模拟器 CPU 不足,并且 AX Action 在启动应用程序时超时。通过使用电源管理降低 CPU 性能,我能够在自己的机器上重现此情况(通常不会出现故障)。

增加 Bitrise 中的 CPU 分配是显而易见的解决方案。然而,还有另一种奇怪的解决方案!

在测试的设置函数之前,我有以下行:

让 app = XCUIApplication()

这允许我的各种测试调用 app. 而不是更长、完整的语法。

删除此行可以防止错误发生。这是通过 Apple 开发者论坛主题找到的:

https://forums.developer.apple.com/thread/4472

所以...希望这可以为其他人解决这个问题,但它也为我解决了这个问题。

关于ios - Bitrise 测试(有些一致,有些不一致)失败并出现 "AX action"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37664444/

相关文章:

xctest - allElementsBoundByAccessibilityElement 的含义

ios - UI 测试滑动删除表格 View 单元格

ios - FaSTLane 无法在 Bitrise 上找到配置文件

ios - Bitrise - 无法从 App Store Connect 接收最新的 API key ,这可能是服务器问题

android - Android 13(API 级别 33)的 Bitrise 构建失败

ios - 在本地通知到达时管理启动屏幕

android - 将一个 LabelView 动态放置在另一个 LabelView 下

ios - UIImagePickerController & View 不在窗口层次结构中

iOS CIImage 拉伸(stretch)图像

swift - 如何使用 Swift 在 XCode UI Automation 中选择随机 tableview 单元格