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 and SystemAlertCancel 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 return true if they handled the UI, false if they did not.
    See more

    Declaration

    Swift

    public protocol SystemAlert: SystemMessages
  • 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 return true if they handled the UI, false if they did not.
    See more

    Declaration

    Swift

    public struct HealthAuthorizationDontAllowAlert: SystemAlert, HealthAlertOk
  • 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 return true if they handled the UI, false if they did not.
    See more

    Declaration

  • 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 return true if they handled the UI, false if they did not.
    See more

    Declaration

    Swift

    public struct LocationUpgradeWhenInUseAlwaysAlert: SystemAlert, LocationAlwaysAlertAllow, LocationAlwaysAlertAllowWhenInUseOnly
  • 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 return true if they handled the UI, false if they did not.
    See more

    Declaration

    Swift

    public struct LocationWhenInUseAlert: SystemAlert, LocationAlertAllow, LocationAlertDeny
  • 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 return true if they handled the UI, false if they did not.
    See more

    Declaration

    Swift

    public struct AddressBookAlert: SystemAlert, SystemAlertAllow, SystemAlertDeny
  • 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 return true if they handled the UI, false if they did not.
    See more

    Declaration

    Swift

    public struct BluetoothPeripheralAlert: SystemAlert, SystemAlertAllow, SystemAlertDeny
  • 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 return true if they handled the UI, false if they did not.
    See more

    Declaration

    Swift

    public struct CalendarAlert: SystemAlert, SystemAlertAllow, SystemAlertDeny
  • 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 return true if they handled the UI, false if they did not.
    See more

    Declaration

    Swift

    public struct CallsAlert: SystemAlert, SystemAlertAllow, SystemAlertDeny
  • 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 return true if they handled the UI, false if they did not.
    See more

    Declaration

    Swift

    public struct CameraAlert: SystemAlert, SystemAlertAllow, SystemAlertDeny
  • 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 return true if they handled the UI, false if they did not.
    See more

    Declaration

    Swift

    public struct MediaLibraryAlert: SystemAlert, SystemAlertAllow, SystemAlertDeny
  • 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 return true if they handled the UI, false if they did not.
    See more

    Declaration

    Swift

    public struct MicrophoneAlert: SystemAlert, SystemAlertAllow, SystemAlertDeny
  • 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 return true if they handled the UI, false if they did not.
    See more

    Declaration

    Swift

    public struct MotionAlert: SystemAlert, SystemAlertAllow, SystemAlertDeny
  • 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 return true if they handled the UI, false if they did not.
    See more

    Declaration

    Swift

    public struct PhotosAlert: SystemAlert, SystemAlertAllow, SystemAlertDeny
  • 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 return true if they handled the UI, false if they did not.
    See more

    Declaration

    Swift

    public struct RemindersAlert: SystemAlert, SystemAlertAllow, SystemAlertDeny
  • 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 return true if they handled the UI, false if they did not.
    See more

    Declaration

    Swift

    public struct SiriAlert: SystemAlert, SystemAlertAllow, SystemAlertDeny
  • 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 return true if they handled the UI, false if they did not.
    See more

    Declaration

    Swift

    public struct SpeechRecognitionAlert: SystemAlert, SystemAlertAllow, SystemAlertDeny
  • 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 return true if they handled the UI, false if they did not.
    See more

    Declaration

    Swift

    public struct WillowAlert: SystemAlert, SystemAlertAllow, SystemAlertDeny