pod*_*nro 6 xcode xctest swift xcuitest ios14
自从将我的设备(iPhone 11)升级到 iOS 14.0.1 后,我发现 addUIInterruptionMonitor() 根本不会被触发。它之前在 iOS 13.4.1 上运行,这是我安装的最后一个版本。
我的代码:
addUIInterruptionMonitor(withDescription: "App Would Like to Send You Notifications") { (alert) -> Bool in
if alert.buttons["Allow"].exists {
alert.buttons["Allow"].tap()
return true
}
return false
}
XCUIApplication().tap() // interacting with the app to trigger the interruption monitor
Run Code Online (Sandbox Code Playgroud)
升级后我的代码没有任何变化 - 唯一发生变化的是安装了 iOS 版本。有没有其他人遇到过类似的?
我已经用这段代码工作了:
XCUIApplication.otherElements.firstMatch.swipeLeft()
Run Code Online (Sandbox Code Playgroud)
或者
app.otherElements.firstMatch.swipeLeft()
Run Code Online (Sandbox Code Playgroud)
解决方案是使用otherElements.firstMatch. 不知何故,只有在视图层次结构otherElements内部XCUIApplication。您可以使用tap-event 或swipe-event。我发现swipe-event 对 UITest 状态破坏性最小。
| 归档时间: |
|
| 查看次数: |
177 次 |
| 最近记录: |