【发布时间】:2017-03-27 02:05:02
【问题描述】:
当测试在 12.9 英寸 iPad Pro 上运行时,我的 Xcode UI 测试代码因此错误而失败。对于所有 iPhone 型号和 iPad Retina,都没有出现错误。
断言失败:EasyTVUITests.m:81:UI 测试失败 - 计算 单元格 0x600000377dc0 的无效生命值(-1.0,-1.3):特征: 8589934592, {{411.0, -1373.0}, {813.3, 106.3}}
失败的测试代码行是这一行:
[[app.tables[@"programs"].cells elementBoundByIndex:17] tap];
错误的实际含义是什么,我该如何调试它?
这是错误的完整运行:
点击单元格
Wait for app to idle Find the Cell Snapshot accessibility hierarchy for com.[hidden] Find: Descendants matching type Table Find: Elements matching predicate '"programs" IN identifiers' Find: Descendants matching type Cell Find: Element at index 17 Wait for app to idle Synthesise event Assertion Failure: EasyTVUITests.m:81: UI Testing Failure - Computed invalid hit point (-1.0, -1.3) for Cell 0x600000377dc0: traits: 8589934592, {{411.0, -1373.0}, {813.3, 106.3}}
索引是 17 并不重要——我只是想随机选择一个单元格。我尝试了另一个索引,但没有任何区别。
从视觉上看,iPad Pro 版本与 iPad Retina 版本没有“错误”或不同。
这是 Xcode 8.1,iPad 模拟器运行 iOS 10.1。
【问题讨论】:
-
如果有人因为
app.buttons["delete"].tap()不工作而到达这里(就像我一样),您可以将其换成element.typeText(XCUIKeyboardKeyDelete),其中element是您想要删除键的文本字段或类似字段发送到。
标签: ios objective-c ipad xcode-ui-testing xcode8.1