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
  • 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.

    Warning

    The alert seems to be visible in view hierarchy and work without an interruption monitor dance. Check working example here: AutoMateExample PermissionsTests -testHealthKitAlert
    See more
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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