【发布时间】:2023-03-28 10:46:01
【问题描述】:
在我的 UI 测试开始时,我有
addUIInterruptionMonitor(withDescription: "Location Dialog") { (alert) -> Bool in
let button = alert.buttons["Allow"]
if button.exists {
snapshot("request location service")
button.tap()
return true
}
return false
}
它应该关闭位置服务请求对话框,但它什么也不做,它永远不会到达处理程序。我也尝试在setUp() 中设置此代码,但它也不起作用。
我认为问题可能是应用程序中发生的第一件事是显示对话框,可能为时过早(可能在调用addUIInterruptionMonitor 之前发生)
我该如何解决这个问题?
【问题讨论】:
标签: ios swift xcode-ui-testing