我正在编写 XCTest 应用程序测试来测试一些UIViewControllers
通过致电presentViewController
on the UIApplication
rootViewController
.
除了权限对话框之外,这工作得很好。一些UIViewControllers
让系统弹出相机或麦克风访问等权限对话框。我不知道如何解雇他们。
如果这是一个 UI 测试,我可以使用addUIInterruptionMonitorWithDescription
and tap
警报消失。
但是,我不确定如何进行这项工作。应用程序测试可以访问 UI 测试功能吗?
在 xcode ui 测试中,要访问系统弹出权限对话框,请使用以下代码:
self.addUIInterruptionMonitorWithDescription("your alert text", handler: { (alert) -> Bool in
yourAlertElement.tap()
return true
})
希望这会有所帮助,如果您有任何困惑,请告诉我。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)