Constants

The following constants are available globally.

  • Key for currently set failure handler for EarlGrey in thread’s local storage dictionary.

    Declaration

    Objective-C

    extern NSString *const kGREYFailureHandlerKey
  • Error domain for keyboard dismissal.

    Declaration

    Objective-C

    extern NSString *const kGREYKeyboardDismissalErrorDomain
  • Configuration that enables or disables usage tracking for the framework.

    Accepted values: @c BOOL (i.e. @c YES or @c NO) Default value: @c YES

    Declaration

    Objective-C

    extern NSString *const _Nonnull kGREYConfigKeyAnalyticsEnabled
  • Configuration that enables or disables constraint checks before performing an action.

    Accepted values: @c BOOL (i.e. @c YES or @c NO) Default value: @c YES

    Declaration

    Objective-C

    extern NSString *const _Nonnull kGREYConfigKeyActionConstraintsEnabled
  • Configuration that holds timeout duration (in seconds) for actions and assertions. Actions or assertions that are not scheduled within this time will fail with a timeout. If the action or assertion starts within the timeout duration and if a search action is provided, then the search action will execute at least once regardless of the timeout duration.

    Accepted values: @c double (negative values are invalid) Default value: 30.0

    Declaration

    Objective-C

    extern NSString *const _Nonnull kGREYConfigKeyInteractionTimeoutDuration
  • Configuration that enables or disables EarlGrey’s synchronization feature. When disabled, any command that used to wait for the app to idle before proceeding will no longer do so.

    @remark For more fine-grained control over synchronization parameters, you can tweak other provided configuration options below.

    Accepted values: @c BOOL (i.e. @c YES or @c NO) Default value: @c YES

    Declaration

    Objective-C

    extern NSString *const _Nonnull kGREYConfigKeySynchronizationEnabled
  • Configuration for setting the max interval (in seconds) of non-repeating NSTimers that EarlGrey will automatically track.

    Accepted values: @c double (negative values are invalid) Default value: 1.5

    Declaration

    Objective-C

    extern NSString *const _Nonnull kGREYConfigKeyNSTimerMaxTrackableInterval
  • Configuration for setting the max delay (in seconds) for dispatch_after and dispatch_after_f calls that EarlGrey will automatically track. dispatch_after and dispatch_after_f calls exceeding the specified time won’t be tracked by the framework.

    Accepted values: @c double (negative values are invalid) Default value: 1.5

    Declaration

    Objective-C

    extern NSString *const _Nonnull kGREYConfigKeyDispatchAfterMaxTrackableDelay
  • Configuration for setting the max duration (in seconds) for delayed executions on the main thread originating from any performSelector:afterDelay invocations that EarlGrey will automatically track.

    Accepted values: @c double (negative values are invalid) Default value: 1.5

    Declaration

    Objective-C

    extern NSString *const _Nonnull kGREYConfigKeyDelayedPerformMaxTrackableDuration
  • Configuration that determines whether or not CALayer animations are modified. If @c YES, then cyclic animations are set to run only once and the animation duration is limited to a maximum of @c kGREYConfigKeyCALayerMaxAnimationDuration.

    @remark This should only be used if synchronization is disabled; otherwise cyclic animations will cause EarlGrey to timeout and fail tests.

    Accepted values: @c BOOL (i.e. @c YES or @c NO) Default value: @c YES

    Declaration

    Objective-C

    extern NSString *const _Nonnull kGREYConfigKeyCALayerModifyAnimations
  • Configuration for setting max allowable animation duration (in seconds) for any CALayer based animation. Animations exceeding the specified time will have their duration truncated to value specified by this config.

    Accepted values: @c double (negative values are invalid) Default value: 10.0

    Declaration

    Objective-C

    extern NSString *const _Nonnull kGREYConfigKeyCALayerMaxAnimationDuration
  • Configuration that holds regular expressions for URLs that are blacklisted from synchronization. EarlGrey will not wait for any network request with URLs matching the blacklisted regular expressions to complete. Most frequently blacklisted URLs include those used for sending analytics, pingbacks, and background network tasks that don’t interfere with testing.

    @remark By default, EarlGrey will not synchronize with any URLs with data scheme.

    Accepted values: @c An @c NSArray of valid regular expressions as @c NSString. The strings must be accepted by @c NSRegularExpression. Default value: an empty @c NSArray

    Declaration

    Objective-C

    extern NSString *const _Nonnull kGREYConfigKeyURLBlacklistRegex
  • Configuration that enables/disables inclusion of status bar window in every operation performed by EarlGrey. By default, the status bar window is excluded from screenshots and UI hierarchy.

    Accepted values: @c BOOL (i.e. @c YES or @c NO) Default value: NO

    Declaration

    Objective-C

    extern NSString *const _Nonnull kGREYConfigKeyIncludeStatusBarWindow
  • Configuration for setting a directory location where any test artifacts such as screenshots, test logs, etc. are stored. The user should ensure that the location provided is writable by the test.

    Accepted values: NSString containing a valid absolute filepath that is writable by the test. Default value: @c nil

    Declaration

    Objective-C

    extern NSString *const _Nonnull kGREYConfigKeyArtifactsDirLocation
  • Generic framework failure.

    Declaration

    Objective-C

    extern NSString *const _Nonnull kGREYGenericFailureException
  • Thrown on action failure.

    Declaration

    Objective-C

    extern NSString *const _Nonnull kGREYActionFailedException
  • Thrown on assertion failure.

    Declaration

    Objective-C

    extern NSString *const _Nonnull kGREYAssertionFailedException
  • Thrown when assertion failed due to an unexpected @c nil parameter.

    Declaration

    Objective-C

    extern NSString *const _Nonnull kGREYNilException
  • Thrown when assertion failed due to an unexpected non-nil parameter.

    Declaration

    Objective-C

    extern NSString *const _Nonnull kGREYNotNilException
  • Thrown by the selection API when no UI element matches the selection matcher.

    Declaration

    Objective-C

    extern NSString *const _Nonnull kGREYNoMatchingElementException
  • Thrown by the interaction API when either an action or assertion matcher matches multiple elements in the UI hierarchy.

    Declaration

    Objective-C

    extern NSString *const _Nonnull kGREYMultipleElementsFoundException
  • Thrown by the interaction API when either an action or assertion times out waiting for the app to become idle.

    Declaration

    Objective-C

    extern NSString *const _Nonnull kGREYTimeoutException
  • Thrown by the action API when the constraints required for performing the action are not satisfied.

    Declaration

    Objective-C

    extern NSString *const _Nonnull kGREYConstraintFailedException
  • Error domain for element interaction failures.

    Declaration

    Objective-C

    extern NSString *const kGREYInteractionErrorDomain
  • Notification name for when an action will be performed. The action itself is contained in the @c userInfo object from the @c notification and can be obtained using the key @c kGREYActionUserInfoKey.

    Declaration

    Objective-C

    extern NSString *const kGREYWillPerformActionNotification
  • Notification name for when an action has been performed. The action itself is contained in the @c userInfo object from the @c notification and can be obtained using the key @c kGREYActionUserInfoKey.

    Declaration

    Objective-C

    extern NSString *const kGREYDidPerformActionNotification
  • Notification name for when an assertion will be checked. The assertion itself is contained in the @c userInfo object from the @c notification and can be obtained using the key @c kGREYAssertionUserInfoKey.

    Declaration

    Objective-C

    extern NSString *const kGREYWillPerformAssertionNotification
  • Notification name for when an assertion has been performed. The assertion itself is contained in the @c userInfo object from the @c notification and can be obtained using the key @c kGREYAssertionUserInfoKey.

    Declaration

    Objective-C

    extern NSString *const kGREYDidPerformAssertionNotification
  • User Info dictionary key for the action performed.

    Declaration

    Objective-C

    extern NSString *const kGREYActionUserInfoKey
  • User Info dictionary key for the element an action was performed on. The element for an assertion can be @c nil in case of an error.

    Declaration

    Objective-C

    extern NSString *const kGREYActionElementUserInfoKey
  • User Info dictionary key for any error populated on the action being performed.

    Declaration

    Objective-C

    extern NSString *const kGREYActionErrorUserInfoKey
  • User Info dictionary key for the assertion checked.

    Declaration

    Objective-C

    extern NSString *const kGREYAssertionUserInfoKey
  • User Info dictionary key for the element an assertion was checked on. The element for an assertion can be @c nil since assertions can be performed on @c nil elements.

    Declaration

    Objective-C

    extern NSString *const kGREYAssertionElementUserInfoKey
  • User Info dictionary key for any error populated on the assertion being checked.

    Declaration

    Objective-C

    extern NSString *const kGREYAssertionErrorUserInfoKey
  • The Error domain for a scroll error.

    Declaration

    Objective-C

    extern NSString *const kGREYScrollErrorDomain