我正在使用新的自动化框架在Xcode7中编写UI测试用例,但我无法获得方法名称来验证是否出现触摸提示,然后关闭显示在我的应用程序中的触摸id提示。
发布于 2016-03-24 17:48:14
我不能模拟手指触摸,但我可以使用测试框架中提供的addUIInterruptionMonitorWithDescription api取消触摸id提示。
我使用以下代码关闭了该对话框
addUIInterruptionMonitorWithDescription("Touch ID") { (alert) -> Bool in
alert.buttons["Cancel"].tap()
return true
}
app.tap()发布于 2016-03-22 15:26:35
您可以通过使身份验证LAContext无效来关闭触摸ID提示。关闭TouchID提示符是在ios9中引入的:
func invalidateAuthenticationAlert(authContextObjext: LAContext){
print("Dismiss current prompt")
authContextObjext.invalidate()
}记住:-
发布于 2017-10-05 21:42:51
在Xcode9中,您可以访问跳板关闭TouchID提示符:
func testExample() {
let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard")
let app = XCUIApplication()
app.launch()
// this causes the TouchID prompt to be displayed
app.buttons["Press Me!"].tap()
if springboard.alerts.buttons["Cancel"].waitForExistence(timeout: 10) {
springboard.alerts.buttons["Cancel"].tap()
}
// continue test
}https://stackoverflow.com/questions/36029279
复制相似问题