SystemAlert

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.
  • Collection of messages possible to receive due to system service request.

  • Alert element.

  • Initialize system alert with interrupting element.

    Note

    Method returns nil if the element doesn’t represent specified system alert.