System alerts
-
Protocol defining system service request alert. Provides essential definitions for system alerts giving the ability to handle them in the UI tests.
System alerts supposed to be used in the handler of the
XCTestCase.addUIInterruptionMonitor(withDescription:handler:)
method. Additional protocols,SystemAlertAllow
,SystemAlertDeny
,SystemAlertOk
andSystemAlertCancel
provides definition and default implementation for handling buttons on the alert view.Note
AutoMate
provides an implementation for several different system alerts. Check the documentation for full list of supported system alerts.Example:
let token = addUIInterruptionMonitor(withDescription: "Contacts") { (alert) -> Bool in guard let alert = AddressBookAlert(element: alert) else { XCTFail("Cannot create AddressBookAlert object") return false } alert.denyElement.tap() return true } mainPage.goToPermissionsPageMenu() // Interruption won't happen without some kind of action. app.tap() removeUIInterruptionMonitor(token)
Note
Handlers should returntrue
if they handled the UI,false
if they did not.
-
Represents
HealthAuthorizationDontAllowAlert
service alert.System alert supposed to be used in the handler of the
XCTestCase.addUIInterruptionMonitor(withDescription:handler:)
method.Example:
let token = addUIInterruptionMonitor(withDescription: "Alert") { (alert) -> Bool in guard let alert = HealthAuthorizationDontAllowAlert(element: alert) else { XCTFail("Cannot create HealthAuthorizationDontAllowAlert object") return false } alert.allowElement.tap() return true } mainPage.goToPermissionsPageMenu() // Interruption won't happen without some kind of action. app.tap() removeUIInterruptionMonitor(token)
Note
Handlers should returntrue
if they handled the UI,false
if they did not.Warning
The alert seems to be visible in view hierarchy and work without aninterruption monitor dance
. Check working example here: AutoMateExamplePermissionsTests -testHealthKitAlert
-
Represents
LocationAlwaysAlert
service alert.System alert supposed to be used in the handler of the
XCTestCase.addUIInterruptionMonitor(withDescription:handler:)
method.Example:
let token = addUIInterruptionMonitor(withDescription: "Alert") { (alert) -> Bool in guard let alert = LocationAlwaysAlert(element: alert) else { XCTFail("Cannot create LocationAlwaysAlert object") return false } alert.allowElement.tap() return true } mainPage.goToPermissionsPageMenu() // Interruption won't happen without some kind of action. app.tap() removeUIInterruptionMonitor(token)
Note
Handlers should returntrue
if they handled the UI,false
if they did not. -
Represents
LocationUpgradeWhenInUseAlwaysAlert
service alert.System alert supposed to be used in the handler of the
XCTestCase.addUIInterruptionMonitor(withDescription:handler:)
method.Example:
let token = addUIInterruptionMonitor(withDescription: "Alert") { (alert) -> Bool in guard let alert = LocationUpgradeWhenInUseAlwaysAlert(element: alert) else { XCTFail("Cannot create LocationUpgradeWhenInUseAlwaysAlert object") return false } alert.allowElement.tap() return true } mainPage.goToPermissionsPageMenu() // Interruption won't happen without some kind of action. app.tap() removeUIInterruptionMonitor(token)
Note
Handlers should returntrue
if they handled the UI,false
if they did not. -
Represents
LocationWhenInUseAlert
service alert.System alert supposed to be used in the handler of the
XCTestCase.addUIInterruptionMonitor(withDescription:handler:)
method.Example:
let token = addUIInterruptionMonitor(withDescription: "Alert") { (alert) -> Bool in guard let alert = LocationWhenInUseAlert(element: alert) else { XCTFail("Cannot create LocationWhenInUseAlert object") return false } alert.allowElement.tap() return true } mainPage.goToPermissionsPageMenu() // Interruption won't happen without some kind of action. app.tap() removeUIInterruptionMonitor(token)
Note
Handlers should returntrue
if they handled the UI,false
if they did not.
-
Represents
AddressBookAlert
service alert.System alert supposed to be used in the handler of the
XCTestCase.addUIInterruptionMonitor(withDescription:handler:)
method.Example:
let token = addUIInterruptionMonitor(withDescription: "Alert") { (alert) -> Bool in guard let alert = AddressBookAlert(element: alert) else { XCTFail("Cannot create AddressBookAlert object") return false } alert.denyElement.tap() return true } mainPage.goToPermissionsPageMenu() // Interruption won't happen without some kind of action. app.tap() removeUIInterruptionMonitor(token)
Note
Handlers should returntrue
if they handled the UI,false
if they did not. -
Represents
BluetoothPeripheralAlert
service alert.System alert supposed to be used in the handler of the
XCTestCase.addUIInterruptionMonitor(withDescription:handler:)
method.Example:
let token = addUIInterruptionMonitor(withDescription: "Alert") { (alert) -> Bool in guard let alert = BluetoothPeripheralAlert(element: alert) else { XCTFail("Cannot create BluetoothPeripheralAlert object") return false } alert.denyElement.tap() return true } mainPage.goToPermissionsPageMenu() // Interruption won't happen without some kind of action. app.tap() removeUIInterruptionMonitor(token)
Note
Handlers should returntrue
if they handled the UI,false
if they did not. -
Represents
CalendarAlert
service alert.System alert supposed to be used in the handler of the
XCTestCase.addUIInterruptionMonitor(withDescription:handler:)
method.Example:
let token = addUIInterruptionMonitor(withDescription: "Alert") { (alert) -> Bool in guard let alert = CalendarAlert(element: alert) else { XCTFail("Cannot create CalendarAlert object") return false } alert.denyElement.tap() return true } mainPage.goToPermissionsPageMenu() // Interruption won't happen without some kind of action. app.tap() removeUIInterruptionMonitor(token)
Note
Handlers should returntrue
if they handled the UI,false
if they did not. -
Represents
CallsAlert
service alert.System alert supposed to be used in the handler of the
XCTestCase.addUIInterruptionMonitor(withDescription:handler:)
method.Example:
let token = addUIInterruptionMonitor(withDescription: "Alert") { (alert) -> Bool in guard let alert = CallsAlert(element: alert) else { XCTFail("Cannot create CallsAlert object") return false } alert.denyElement.tap() return true } mainPage.goToPermissionsPageMenu() // Interruption won't happen without some kind of action. app.tap() removeUIInterruptionMonitor(token)
Note
Handlers should returntrue
if they handled the UI,false
if they did not. -
Represents
CameraAlert
service alert.System alert supposed to be used in the handler of the
XCTestCase.addUIInterruptionMonitor(withDescription:handler:)
method.Example:
let token = addUIInterruptionMonitor(withDescription: "Alert") { (alert) -> Bool in guard let alert = CameraAlert(element: alert) else { XCTFail("Cannot create CameraAlert object") return false } alert.denyElement.tap() return true } mainPage.goToPermissionsPageMenu() // Interruption won't happen without some kind of action. app.tap() removeUIInterruptionMonitor(token)
Note
Handlers should returntrue
if they handled the UI,false
if they did not. -
Represents
MediaLibraryAlert
service alert.System alert supposed to be used in the handler of the
XCTestCase.addUIInterruptionMonitor(withDescription:handler:)
method.Example:
let token = addUIInterruptionMonitor(withDescription: "Alert") { (alert) -> Bool in guard let alert = MediaLibraryAlert(element: alert) else { XCTFail("Cannot create MediaLibraryAlert object") return false } alert.denyElement.tap() return true } mainPage.goToPermissionsPageMenu() // Interruption won't happen without some kind of action. app.tap() removeUIInterruptionMonitor(token)
Note
Handlers should returntrue
if they handled the UI,false
if they did not. -
Represents
MicrophoneAlert
service alert.System alert supposed to be used in the handler of the
XCTestCase.addUIInterruptionMonitor(withDescription:handler:)
method.Example:
let token = addUIInterruptionMonitor(withDescription: "Alert") { (alert) -> Bool in guard let alert = MicrophoneAlert(element: alert) else { XCTFail("Cannot create MicrophoneAlert object") return false } alert.denyElement.tap() return true } mainPage.goToPermissionsPageMenu() // Interruption won't happen without some kind of action. app.tap() removeUIInterruptionMonitor(token)
Note
Handlers should returntrue
if they handled the UI,false
if they did not. -
Represents
MotionAlert
service alert.System alert supposed to be used in the handler of the
XCTestCase.addUIInterruptionMonitor(withDescription:handler:)
method.Example:
let token = addUIInterruptionMonitor(withDescription: "Alert") { (alert) -> Bool in guard let alert = MotionAlert(element: alert) else { XCTFail("Cannot create MotionAlert object") return false } alert.denyElement.tap() return true } mainPage.goToPermissionsPageMenu() // Interruption won't happen without some kind of action. app.tap() removeUIInterruptionMonitor(token)
Note
Handlers should returntrue
if they handled the UI,false
if they did not. -
Represents
PhotosAlert
service alert.System alert supposed to be used in the handler of the
XCTestCase.addUIInterruptionMonitor(withDescription:handler:)
method.Example:
let token = addUIInterruptionMonitor(withDescription: "Alert") { (alert) -> Bool in guard let alert = PhotosAlert(element: alert) else { XCTFail("Cannot create PhotosAlert object") return false } alert.denyElement.tap() return true } mainPage.goToPermissionsPageMenu() // Interruption won't happen without some kind of action. app.tap() removeUIInterruptionMonitor(token)
Note
Handlers should returntrue
if they handled the UI,false
if they did not. -
Represents
RemindersAlert
service alert.System alert supposed to be used in the handler of the
XCTestCase.addUIInterruptionMonitor(withDescription:handler:)
method.Example:
let token = addUIInterruptionMonitor(withDescription: "Alert") { (alert) -> Bool in guard let alert = RemindersAlert(element: alert) else { XCTFail("Cannot create RemindersAlert object") return false } alert.denyElement.tap() return true } mainPage.goToPermissionsPageMenu() // Interruption won't happen without some kind of action. app.tap() removeUIInterruptionMonitor(token)
Note
Handlers should returntrue
if they handled the UI,false
if they did not. -
Represents
SiriAlert
service alert.System alert supposed to be used in the handler of the
XCTestCase.addUIInterruptionMonitor(withDescription:handler:)
method.Example:
let token = addUIInterruptionMonitor(withDescription: "Alert") { (alert) -> Bool in guard let alert = SiriAlert(element: alert) else { XCTFail("Cannot create SiriAlert object") return false } alert.denyElement.tap() return true } mainPage.goToPermissionsPageMenu() // Interruption won't happen without some kind of action. app.tap() removeUIInterruptionMonitor(token)
Note
Handlers should returntrue
if they handled the UI,false
if they did not. -
Represents
SpeechRecognitionAlert
service alert.System alert supposed to be used in the handler of the
XCTestCase.addUIInterruptionMonitor(withDescription:handler:)
method.Example:
let token = addUIInterruptionMonitor(withDescription: "Alert") { (alert) -> Bool in guard let alert = SpeechRecognitionAlert(element: alert) else { XCTFail("Cannot create SpeechRecognitionAlert object") return false } alert.denyElement.tap() return true } mainPage.goToPermissionsPageMenu() // Interruption won't happen without some kind of action. app.tap() removeUIInterruptionMonitor(token)
Note
Handlers should returntrue
if they handled the UI,false
if they did not. -
Represents
WillowAlert
service alert.System alert supposed to be used in the handler of the
XCTestCase.addUIInterruptionMonitor(withDescription:handler:)
method.Example:
let token = addUIInterruptionMonitor(withDescription: "Alert") { (alert) -> Bool in guard let alert = WillowAlert(element: alert) else { XCTFail("Cannot create WillowAlert object") return false } alert.denyElement.tap() return true } mainPage.goToPermissionsPageMenu() // Interruption won't happen without some kind of action. app.tap() removeUIInterruptionMonitor(token)
Note
Handlers should returntrue
if they handled the UI,false
if they did not.