Auth0 Home Blog Docs

XCTestCase: How to dismiss security alert “XXXX” Wants to Use “auth0.com”

swift
auth0-lock
lock
ios
lock-for-ios

#1

So recently Apple introduced this prompt: “XXXX” Wants to Use “auth0.com” to Sign In
Where “XXXX” is the ios app name.

This alert/dialog comes up when in the case of Auth0 the user clicks on “Login with Google” or “Login with Facebook”. That’s all nice but when running IOS UI tests, this dialog doesn’t go away when using the usual way of dismissing system dialogs:

func doUserLogin(_ app: XCUIApplication) {

    app.staticTexts["notLoggedInActivelabel"].tap()

    let handler = self.addUIInterruptionMonitor (withDescription: "allow oauth") { (alert) -> Bool in
        alert.buttons["Continue"].tap()
        return true
    }
    
    app.scrollViews.otherElements.buttons["LOG IN WITH GOOGLE"].tap()
    app.tap()
    
    removeUIInterruptionMonitor(handler)
}

Woulkd anyone know how to dismiss this dialog in an XCTestCase?