Skip to content

Instantly share code, notes, and snippets.

@bootstraponline
Last active May 24, 2016 14:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bootstraponline/81d8c9aa99f98cd6d9e78c5293d8f906 to your computer and use it in GitHub Desktop.
Save bootstraponline/81d8c9aa99f98cd6d9e78c5293d8f906 to your computer and use it in GitHub Desktop.

EarlGrey Swift Matchers

User Properties

grey_accessibilityID(NSString *accessibilityID);
grey_accessibilityLabel(NSString *label);
grey_accessibilityValue(NSString *grey_accessibilityValue);
grey_accessibilityTrait(UIAccessibilityTraits traits);
grey_accessibilityHint(NSString *hint);
grey_text(NSString *inputText);

UI Properties

grey_minimumVisiblePercent(CGFloat percent);
grey_sufficientlyVisible(void);
grey_interactable(void);
grey_notVisible(void);
grey_systemAlertViewShown(void);
grey_enabled(void);
grey_layout(NSArray *constraints, id<GREYMatcher> referenceElementMatcher);
grey_nil(void);
grey_notNil(void);

Hierarchy

grey_ancestor(id<GREYMatcher> ancestorMatcher);
grey_descendant(id<GREYMatcher> descendantMatcher);

Class

grey_kindOfClass(Class klass);
grey_respondsToSelector(SEL sel);
grey_conformsToProtocol(Protocol *protocol);

Other

grey_keyWindow(void);
grey_firstResponder(void);
grey_accessibilityElement(void);
grey_progress(id<GREYMatcher> comparisonMatcher);
grey_buttonTitle(NSString *text);
grey_stepperValue(double value);
grey_sliderValueMatcher(id<GREYMatcher> valueMatcher);
grey_pickerColumnSetToValue(NSInteger column, NSString *value);
grey_datePickerValue(NSDate *date);
grey_switchWithOnState(BOOL on);
grey_closeTo(double value, double delta);

Object Matchers

grey_allOfMatchers(args: AnyObject...)
grey_anyOfMatchers(args: AnyObject...)

View Actions

Click/Press

grey_tap(void);
grey_tapAtPoint(CGPoint point);
grey_doubleTap(void);
grey_longPress(void);
grey_longPressWithDuration(CFTimeInterval duration);
grey_longPressAtPointWithDuration(CGPoint point,
                                  CFTimeInterval duration);

Gestures

grey_scrollInDirection(GREYDirection direction, CGFloat amount);
grey_scrollToContentEdge(GREYContentEdge edge);
grey_swipeFastInDirection(GREYDirection direction);
grey_swipeSlowInDirection(GREYDirection direction);
grey_swipeFastInDirectionWithStartPoint(GREYDirection direction,
                                        CGFloat xStartPoint,
                                        CGFloat yStartPoint);
grey_swipeSlowInDirectionWithStartPoint(GREYDirection direction,
                                        CGFloat xStartPoint,
                                        CGFloat yStartPoint);

Text

grey_typeText(NSString *text);
grey_clearText(void);

Other

grey_moveSliderToValue(float value);
grey_setStepperValue(double value);
grey_turnSwitchOn(BOOL on);
grey_setDate(NSDate *date);
grey_setPickerColumnToValue(NSInteger column, NSString *value);
grey_javaScriptExecution(NSString *js, __strong NSString **outResult);
grey_snapshot(__strong UIImage **outImage);

Assertions

GREYAssert(...)
GREYAssertTrue(...)
GREYAssertFalse(...)
GREYAssertNotNil(...)
GREYAssertNil(...)
GREYAssertEqual(...)
GREYFail(...)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment