Functions
The following functions are available globally.
-
Shorthand macro for GREYActions::actionForMultipleTapsWithCount: with count @c 2.
Declaration
Objective-C
extern id<GREYAction> grey_doubleTap()
-
Shorthand macro for GREYActions::actionForMultipleTapsWithCount: with count @c 2 and @c point.
Declaration
Objective-C
extern id<GREYAction> grey_doubleTapAtPoint(CGPoint point)
-
Shorthand macro for GREYActions::actionForMultipleTapsWithCount:.
Declaration
Objective-C
extern id<GREYAction> grey_multipleTapsWithCount(NSUInteger count)
-
Shorthand macro for GREYActions::actionForLongPress.
Declaration
Objective-C
extern id<GREYAction> grey_longPress()
-
Shorthand macro for GREYActions::actionForLongPressWithDuration:.
Declaration
Objective-C
extern id<GREYAction> grey_longPressWithDuration(CFTimeInterval duration)
-
Shorthand macro for GREYActions::actionForLongPressAtPoint:duration:.
Declaration
Objective-C
extern id<GREYAction> grey_longPressAtPointWithDuration(CGPoint point, CFTimeInterval duration)
-
Shorthand macro for GREYActions::actionForScrollInDirection:amount:.
Declaration
Objective-C
extern id<GREYAction> grey_scrollInDirection(GREYDirection direction, CGFloat amount)
-
Shorthand macro for GREYActions::actionForScrollInDirection:amount:xOriginStartPercentage:yOriginStartPercentage:.
Declaration
Objective-C
extern id<GREYAction> grey_scrollInDirectionWithStartPoint(GREYDirection direction, CGFloat amount, CGFloat xOriginStartPercentage, CGFloat yOriginStartPercentage)
-
Shorthand macro for GREYActions::actionForScrollToContentEdge:.
Declaration
Objective-C
extern id<GREYAction> grey_scrollToContentEdge(GREYContentEdge edge)
-
Shorthand macro for GREYActions::actionForScrollToContentEdge:xOriginStartPercentage:yOriginStartPercentage:.
Declaration
Objective-C
extern id<GREYAction> grey_scrollToContentEdgeWithStartPoint(GREYContentEdge edge, CGFloat xOriginStartPercentage, CGFloat yOriginStartPercentage)
-
Shorthand macro for GREYActions::actionForSwipeFastInDirection:.
Declaration
Objective-C
extern id<GREYAction> grey_swipeFastInDirection(GREYDirection direction)
-
Shorthand macro for GREYActions::actionForSwipeSlowInDirection:.
Declaration
Objective-C
extern id<GREYAction> grey_swipeSlowInDirection(GREYDirection direction)
-
Shorthand macro for GREYActions::actionForSwipeFastInDirection:xOriginStartPercentage:yOriginStartPercentage:.
Declaration
Objective-C
extern id<GREYAction> grey_swipeFastInDirectionWithStartPoint(GREYDirection direction, CGFloat xOriginStartPercentage, CGFloat yOriginStartPercentage)
-
Shorthand macro for GREYActions::actionForSwipeSlowInDirection:xOriginStartPercentage:yOriginStartPercentage:.
Declaration
Objective-C
extern id<GREYAction> grey_swipeSlowInDirectionWithStartPoint(GREYDirection direction, CGFloat xOriginStartPercentage, CGFloat yOriginStartPercentage)
-
Shorthand macro for GREYActions::actionForMultiFingerSwipeSlowInDirection:numberOfFingers:.
Declaration
Objective-C
extern id<GREYAction> grey_multiFingerSwipeSlowInDirection(GREYDirection direction, NSUInteger numberOfFingers)
-
Shorthand macro for GREYActions::actionForMultiFingerSwipeFastInDirection:numberOfFingers:.
Declaration
Objective-C
extern id<GREYAction> grey_multiFingerSwipeFastInDirection(GREYDirection direction, NSUInteger numberOfFingers)
-
Shorthand macro for GREYActions::actionForMultiFingerSwipeSlowInDirection:numberOfFingers:xOriginStartPercentage: yOriginStartPercentage:.
Declaration
Objective-C
extern id<GREYAction> grey_multiFingerSwipeSlowInDirectionWithStartPoint( GREYDirection direction, NSUInteger numberOfFingers, CGFloat xOriginStartPercentage, CGFloat yOriginStartPercentage)
-
Shorthand macro for GREYActions::actionForMultiFingerSwipeFastInDirection:numberOfFingers:xOriginStartPercentage: yOriginStartPercentage:.
Declaration
Objective-C
extern id<GREYAction> grey_multiFingerSwipeFastInDirectionWithStartPoint( GREYDirection direction, NSUInteger numberOfFingers, CGFloat xOriginStartPercentage, CGFloat yOriginStartPercentage)
-
Shorthand macro for GREYActions::actionForPinchFastInDirection:pinchDirection:angle:.
Declaration
Objective-C
extern id<GREYAction> grey_pinchFastInDirectionAndAngle(GREYPinchDirection pinchDirection, double angle)
-
Shorthand macro for GREYActions::actionForPinchSlowInDirection:pinchDirection:angle:.
Declaration
Objective-C
extern id<GREYAction> grey_pinchSlowInDirectionAndAngle(GREYPinchDirection pinchDirection, double angle)
-
Shorthand macro for GREYActions::actionForMoveSliderToValue:.
Declaration
Objective-C
extern id<GREYAction> grey_moveSliderToValue(float value)
-
Shorthand macro for GREYActions::actionForSetStepperValue:.
Declaration
Objective-C
extern id<GREYAction> grey_setStepperValue(double value)
-
Shorthand macro for GREYActions::actionForTap.
Declaration
Objective-C
extern id<GREYAction> grey_tap()
-
Shorthand macro for GREYActions::actionForTapAtPoint:.
Declaration
Objective-C
extern id<GREYAction> grey_tapAtPoint(CGPoint point)
-
Shorthand macro for GREYActions::actionForTypeText:.
Declaration
Objective-C
extern id<GREYAction> grey_typeText(NSString *text)
-
Shorthand macro for GREYActions::actionForReplaceText:.
Declaration
Objective-C
extern id<GREYAction> grey_replaceText(NSString *text)
-
Shorthand macro for GREYActions::actionForClearText.
Declaration
Objective-C
extern id<GREYAction> grey_clearText()
-
Shorthand macro for GREYActions::actionForTurnSwitchOn:.
Declaration
Objective-C
extern id<GREYAction> grey_turnSwitchOn(BOOL on)
-
Shorthand macro for GREYActions::actionForSetDate:.
Declaration
Objective-C
extern id<GREYAction> grey_setDate(NSDate *date)
-
Shorthand macro for GREYActions::actionForSetPickerColumn:toValue:.
Declaration
Objective-C
extern id<GREYAction> grey_setPickerColumnToValue(NSInteger column, NSString *value)
-
Shorthand macro for GREYActions::actionForJavaScriptExecution:output:.
Declaration
Objective-C
extern id<GREYAction> grey_javaScriptExecution(NSString *js, NSString **outResult)
-
Shorthand macro for GREYActions::actionForSnapshot:.
Declaration
Objective-C
extern id<GREYAction> grey_snapshot(UIImage **outImage)
-
A shorthand matcher that is a logical AND of all the matchers passed in as variable arguments.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_allOf(id<GREYMatcher> _Nonnull first, id<GREYMatcher> _Nonnull second, id<GREYMatcher> _Nullable thirdOrNil, ...)
Parameters
first
The first matcher in the list of matchers.
second
The second matcher in the list of matchers.
thirdOrNil
The third matcher in the list of matchers, optionally the nil terminator.
...
Any more matchers to be added. Matchers are invoked in the order they are specified and only if the preceding matcher passes. This va-arg must be terminated with a @c nil value.
Return Value
An object conforming to GREYMatcher, initialized with the required matchers.
-
A shorthand matcher that is a logical AND of all the matchers passed in within an NSArray.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_allOfMatchers( NSArray<__kindof id<GREYMatcher>> *_Nonnull matchers)
Swift
func grey_allOf(_ matchers: [Any]) -> Any
Parameters
matchers
An NSArray of one or more matchers to be added. Matchers are invoked in the order they are specified and only if the preceding matcher passes.
Return Value
An object conforming to GREYMatcher, initialized with the required matchers.
-
A matcher that is a logical OR of all the matchers passed in as variable arguments.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_anyOf(id<GREYMatcher> _Nonnull first, id<GREYMatcher> _Nonnull second, id<GREYMatcher> _Nullable thirdOrNil, ...)
Parameters
first
The first matcher in the list of matchers.
second
The second matcher in the list of matchers.
thirdOrNil
The third matcher in the list of matchers, optionally the nil terminator.
...
Any more matchers to be added. Matchers are invoked in the order they are specified and only if the preceding matcher fails. This va-arg must be terminated with a @c nil value.
Return Value
An object conforming to GREYMatcher, initialized with the required matchers.
-
A matcher that is a logical OR of all the matchers passed in within an NSArray.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_anyOfMatchers( NSArray<__kindof id<GREYMatcher>> *_Nonnull matchers)
Swift
func grey_anyOf(_ matchers: [Any]) -> Any
Parameters
matchers
An array of one more matchers to be added. Matchers are invoked in the order they are specified and only if the preceding matcher fails.
Return Value
An object conforming to GREYMatcher, initialized with the required matchers.
-
Exposes internal method to get the failure handler registered with EarlGrey. It must be called from main thread otherwise the behavior is undefined.
Declaration
Objective-C
extern id<GREYFailureHandler> grey_getFailureHandler()
Swift
func grey_getFailureHandler() -> Any!
-
Declaration
Objective-C
NSString *NSStringFromUIDeviceOrientation(UIDeviceOrientation deviceOrientation)
Return Value
A string representation of the given @c deviceOrientation.
-
Declaration
Objective-C
NSString *NSStringFromGREYDirection(GREYDirection direction)
Return Value
A string representation of the given @c direction.
-
Returns a string representation of the given @c pinchDirection.
Declaration
Objective-C
NSString *NSStringFromPinchDirection(GREYPinchDirection pinchDirection)
-
Declaration
Objective-C
NSString *NSStringFromGREYContentEdge(GREYContentEdge edge)
Return Value
A string representation of the given @c edge.
-
Declaration
Objective-C
NSString *NSStringFromGREYLayoutAttribute(GREYLayoutAttribute attribute)
Return Value
A string representation of the given layout @c attribute.
-
Declaration
Objective-C
NSString *NSStringFromGREYLayoutRelation(GREYLayoutRelation relation)
Return Value
A string representation of the given layout @c relation.
-
Declaration
Objective-C
NSString *NSStringFromUIAccessibilityTraits(UIAccessibilityTraits traits)
Return Value
A string representation of the given accessibility trait.
-
Shorthand for GREYMatchers::matcherForKeyWindow.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_keyWindow()
-
Shorthand for GREYMatchers::matcherForAccessibilityLabel:.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_accessibilityLabel( NSString *_Nonnull label)
-
Shorthand for GREYMatchers::matcherForAccessibilityID:.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_accessibilityID( NSString *_Nonnull accessibilityID)
-
Shorthand for GREYMatchers::matcherForAccessibilityValue:.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_accessibilityValue( NSString *_Nonnull grey_accessibilityValue)
-
Shorthand for GREYMatchers::matcherForAccessibilityTraits:.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_accessibilityTrait( UIAccessibilityTraits traits)
-
Shorthand for GREYMatchers::matcherForAccessibilityElementIsFocused.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_accessibilityFocused()
-
Shorthand for GREYMatchers::matcherForAccessibilityHint:.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_accessibilityHint(NSString *_Nonnull hint)
-
Shorthand for GREYMatchers::matcherForText:.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_text(NSString *_Nonnull inputText)
-
Shorthand for GREYMatchers::matcherForFirstResponder.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_firstResponder()
-
Shorthand for GREYMatchers::matcherForSystemAlertViewShown.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_systemAlertViewShown()
-
Shorthand for GREYMatchers::matcherForMinimumVisiblePercent:.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_minimumVisiblePercent(CGFloat percent)
-
Shorthand for GREYMatchers::matcherForSufficientlyVisible.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_sufficientlyVisible()
-
Shorthand for GREYMatchers::matcherForInteractable.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_interactable()
-
Shorthand for GREYMatchers::matcherForNotVisible.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_notVisible()
-
Shorthand for GREYMatchers::matcherForAccessibilityElement.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_accessibilityElement()
-
Shorthand for GREYMatchers::matcherForKindOfClass:.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_kindOfClass(Class _Nonnull klass)
-
Shorthand for GREYMatchers::matcherForProgress:.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_progress( id<GREYMatcher> _Nonnull comparisonMatcher)
-
Shorthand for GREYMatchers::matcherForRespondsToSelector:.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_respondsToSelector(SEL _Nonnull sel)
-
Shorthand for GREYMatchers::matcherForConformsToProtocol:.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_conformsToProtocol( Protocol *_Nonnull protocol)
-
Shorthand for GREYMatchers::matcherForAncestor:.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_ancestor( id<GREYMatcher> _Nonnull ancestorMatcher)
-
Shorthand for GREYMatchers::matcherForDescendant:.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_descendant( id<GREYMatcher> _Nonnull descendantMatcher)
-
Shorthand for GREYMatchers::matcherForButtonTitle:.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_buttonTitle(NSString *_Nonnull text)
-
Shorthand for GREYMatchers::matcherForScrollViewContentOffset:.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_scrollViewContentOffset(CGPoint offset)
-
Shorthand for GREYMatchers::matcherForStepperValue:.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_stepperValue(double value)
-
Shorthand for GREYMatchers::matcherForSliderValueMatcher:.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_sliderValueMatcher( id<GREYMatcher> _Nonnull valueMatcher)
-
Shorthand for GREYMatchers::matcherForPickerColumn:setToValue:.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_pickerColumnSetToValue( NSInteger column, NSString *_Nonnull value)
-
Shorthand for GREYMatchers::matcherForDatePickerValue:.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_datePickerValue(NSDate *_Nonnull date)
-
Shorthand for GREYMatchers::matcherForEnabledElement.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_enabled()
-
Shorthand for GREYMatchers::matcherForSelectedElement.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_selected()
-
Shorthand for GREYMatchers::matcherForUserInteractionEnabled.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_userInteractionEnabled()
-
Shorthand for GREYMatchers::matcherForConstraints:toReferenceElementMatching:.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_layout( NSArray *_Nonnull constraints, id<GREYMatcher> _Nonnull referenceElementMatcher)
-
Shorthand for GREYMatchers::matcherForNil.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_nil()
-
Shorthand for GREYMatchers::matcherForNotNil.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_notNil()
-
Shorthand for GREYMatchers::matcherForSwitchWithOnState:.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_switchWithOnState(BOOL on)
-
Shorthand for GREYMatchers::matcherForCloseTo:.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_closeTo(double value, double delta)
-
Shorthand for GREYMatchers::matcherForAnything.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_anything()
-
Shorthand for GREYMatchers::matcherForEqualTo:.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_equalTo(id _Nonnull value)
-
Shorthand for GREYMatchers::matcherForLessThan:.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_lessThan(id _Nonnull value)
-
Shorthand for GREYMatchers::matcherForGreaterThan:.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_greaterThan(id _Nonnull value)
-
Shorthand for GREYMatchers::matcherForScrolledToContentEdge:.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_scrolledToContentEdge(GREYContentEdge edge)
-
Shorthand for GREYMatchers::matcherForTextFieldValue:.
Declaration
Objective-C
extern id<GREYMatcher> _Nonnull grey_textFieldValue(NSString *_Nonnull value)
-
Shorthand macro for GREYNot::initWithMatcher:.
Declaration
Objective-C
extern id<GREYMatcher> grey_not(id<GREYMatcher> matcher)
Swift
func grey_not(_ matcher: Any!) -> Any!
-
Returns a new buffer that contains XRGB pixels for the provided @c imageRef i.e. the alpha channel is removed. If @c outBitmapContext is not @c NULL, it is set to the bitmap context of the returned buffer and caller must call CGContextRelease on it. Each pixel in returned buffer occupies 4 bytes and the buffer must be free()‘d by the caller.
Declaration
Objective-C
extern unsigned char * grey_createImagePixelDataFromCGImageRef(CGImageRef imageRef, CGContextRef *outBmpCtx)
Parameters
imageRef
The source image. @param[out] outBmpCtx Optional bitmap context that holds the returned buffer.
outBmpCtx
Return Value
A new buffer that contains XRGB pixels for the provided image.
-
Executes a block containing EarlGrey statements on the main thread and waits for it to complete. @c block is retained until execution completes. Important: Must be called from a non-main thread otherwise it will block main thread indefinitely.
Declaration
Objective-C
extern void grey_execute_sync(void (^block)())
Parameters
block
Block that will be executed.
-
Executes a block containing EarlGrey statements on the main thread without waiting for it to complete. @c block is retained until execution completes. Can be invoked safely from the main or non-main thread.
Declaration
Objective-C
extern void grey_execute_async(void (^block)())
Parameters
block
Block that will be executed.