How to access Apple Id "Sign In" dialog from UI Test

240 Views Asked by At

I have one UI tests and want to test that I press "close" button. In simulator there is an alert displayed asking to sign in with your apple id. Please see attached Image in URL

Image

1

There are 1 best solutions below

3
drunkencheetah On BEST ANSWER

This alert is part of the Springboard so to handle it you can use either:

let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard")
springboard.alerts["Sign in with your Apple ID").buttons["Close"].tap()

or

let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard")
springboard.alerts.element(boundBy: 0).buttons["Close"].tap()