I'm trying to automate a testing flow in my app, that requires signing in with Apple first. I've figured out how open settings and login with a test Apple ID. I've wrapped that up in a function and call that first (with a check to see if it's already logged in).
When I return to my app, and tapping the sign in with Apple button, I can't find anyway to interact with the sign in with Apple modal, e.g. asking me if I want to share my email address or not, tapping "continue with password" and so on.
I've tried setting up an interruption handler, but it doesn't get triggered.
let test = addUIInterruptionMonitor(withDescription: "") { alert in
print("inside alert:\( alert )")
return true
}
I've tried checking for springboard alerts, but it's not an alert:
let springboardApp = XCUIApplication(bundleIdentifier: "com.apple.springboard")
springboardApp.alerts.exists
I don't know any other tricks, or how to find the bundle ID of this popup. Any advice?
Managed to find the bundle identifier needed
com.apple.AuthKitUIServiceThis is not a complete solution that handles all paths through the modal. Just a sample to get through the flow when you have previously signed in. Just leaving this here to show how to wrap something like this up in a function
How I found this bundle identifier for anyone having similar issues:
running
xcrun simctl list devices --jsonin terminal lists all simulators. Find the UDID of the one you are using then either:run
xcrun simctl listapps <UDID>or go to
~/Library/Developer/CoreSimulator/<UDID>/data/Containers/Dataand do a search for "com.apple"Note:
The above code requires, at least, having logged into an apple id on the simulator. This can be handled with the below, supplying your own credentials
followed by a call to wake up your own app