Handlers

  • Handles launch environments passed by the UI test runner. Launch environments passed by the AutoMate are working.

    LaunchEnvironmentManager should be initialized in the application delegate in method application(_:didFinishLaunchingWithOptions:).

    Example:

    let launchManager = aunchEnvironmentManager()
    launchManager.add(handler: defaultEventKitHander, for: .events)
    launchManager.add(handler: defaultEventKitHander, for: .reminders)
    launchManager.add(handler: defaultContactsHander, for: .contacts)
    launchManager.add(handler: defaultIsInUITestHandler, for: .isInUITest)
    launchManager.add(handler: AnimationHandler(), for: .animation)
    launchManager.setup()
    
    See more

    Declaration

    Swift

    public final class LaunchEnvironmentManager
  • Provides information whether the application is running under UI test environment.

    Handler should be added to LaunchEnvironmentManager.

    Used key: AM_IS_IN_UI_TEST / AutoMateLaunchOptionKey.isInUITest.

    Supported values (case insensitive):

    • true
    • yes
    • 1
    • false
    • no
    • 0

    Example:

    let launchManager = LaunchEnvironmentManager()
    let isInUITest = IsInUITestHandler()
    launchManager.add(handler: isInUITest, for: .isInUITest)
    launchManager.setup()
    

    Later in the code, you can check whether the application is running in UI test environment, by using below example:

    Example:

    if isInUITest.inUITest {
        ...
    }
    

    Note

    defaultIsInUITestHandler singleton could be used intead of creating new instance of the IsInUITestHandler.

    Note

    Launch environment for the handler can be set by the IsInUITestLaunchEnvironment from the AutoMate project.

    Note

    IsInUITestHandler should be used with the AM_IS_IN_UI_TEST key, but its implementation doesn’t require to use it. Any key provided to the LaunchEnvironmentManager.add(handler:for:) method will be handled correctly.

    See more

    Declaration

    Swift

    public class IsInUITestHandler : Handler