有没有办法强制机器人在 xcode 持续集成中始终接受 ui 测试下的权限警报?
Is there a way to force a bot to always accept permission alerts under ui tests in xcode continuous integration?
我需要 运行 使用大量模拟器在 xcode 服务器上持续集成。有没有办法强制它总是接受权限警报,如:
Allow "App" to access your photos
等等...
在您的 setUp()
方法中,创建中断监视器并通过点击“确定”按钮处理警报。这意味着无论何时您尝试与该应用程序交互,都会进行检查以查看权限视图是否妨碍您,然后点击“确定”按钮。
let permissionInterruptionMonitor = addUIInterruptionMonitor(withDescription: "Photos permission alert") { (alert) in
alert.buttons["OK"].tap()
return true // The interruption has been handled
}
如果您的应用程序中可能会出现其他带有“确定”按钮的警报,但您不希望自动处理这些警报,则应确保中断监视器处理程序检查它是否是您发出的警报想处理。
let permissionInterruptionMonitor = addUIInterruptionMonitor(withDescription: "Photos permission alert") { (alert) in
if alert.staticTexts["\"AppName\" Would Like To Access Your Photos"].exists {
alert.buttons["OK"].tap()
return true // The interruption has been handled
}
return false // The interruption has not been handled
}
我需要 运行 使用大量模拟器在 xcode 服务器上持续集成。有没有办法强制它总是接受权限警报,如:
Allow "App" to access your photos
等等...
在您的 setUp()
方法中,创建中断监视器并通过点击“确定”按钮处理警报。这意味着无论何时您尝试与该应用程序交互,都会进行检查以查看权限视图是否妨碍您,然后点击“确定”按钮。
let permissionInterruptionMonitor = addUIInterruptionMonitor(withDescription: "Photos permission alert") { (alert) in
alert.buttons["OK"].tap()
return true // The interruption has been handled
}
如果您的应用程序中可能会出现其他带有“确定”按钮的警报,但您不希望自动处理这些警报,则应确保中断监视器处理程序检查它是否是您发出的警报想处理。
let permissionInterruptionMonitor = addUIInterruptionMonitor(withDescription: "Photos permission alert") { (alert) in
if alert.staticTexts["\"AppName\" Would Like To Access Your Photos"].exists {
alert.buttons["OK"].tap()
return true // The interruption has been handled
}
return false // The interruption has not been handled
}