I am writing UI test case in Xcode 7 with new automation framework but I am not getting the method name to verify whether a touch prompt came or not and then dismiss a touch id prompt which is displayed in my app.
2 Answers
Answers 1
You can dismiss a Touch ID prompt by invalidating authentication LAContext. Dismissing TouchID prompt is introduced in iOS9:-
func invalidateAuthenticationAlert(authContextObjext: LAContext){ print("Dismiss current prompt") authContextObjext.invalidate() } Remember:-
The context is invalidated automatically when it is (auto)released. This method allows invalidating it manually while it is still in scope.
Invalidation terminates any existing policy evaluation and the respective call will fail with LAErrorAppCancel. After the context has been invalidated, it can not be used for policy evaluation and an attempt to do so will fail with LAErrorInvalidContext.
Invalidating a context that has been already invalidated has no effect.
Answers 2
I could not simulate finger touch but i was able to cancel the touch id prompt using addUIInterruptionMonitorWithDescription api available in the test framework
I used the below code to dismiss the dialog
addUIInterruptionMonitorWithDescription("Touch ID") { (alert) -> Bool in alert.buttons["Cancel"].tap() return true } app.tap()
0 comments:
Post a Comment