GREYBaseAction

@interface GREYBaseAction : NSObject <GREYAction>

A base class for all actions that incorporates commonalities between initialization parameters and constraint checking.

  • @remark init is not an available initializer. Use the other initializers.

    Declaration

    Objective-C

    - (instancetype)init;

    Swift

    init!()
  • The designated initializer for a base action with the provided @c constraints.

    Declaration

    Objective-C

    - (instancetype)initWithName:(NSString *)name
                     constraints:(id<GREYMatcher>)constraints;

    Parameters

    name

    The name of the GREYAction being performed.

    constraints

    The constraints to be satisified by the element before the action is performed.

    Return Value

    An instance of GREYBaseAction, initialized with the @c constraints for it to check for.

  • A method that checks that @c element satisfies @c constraints this action was initialized with. Subclasses should call this method if they want to check for constraints in their perform:error: implementation.

    @throws GREYFrameworkException if constraints fail and @c errorOrNilPtr is not provided.

    Declaration

    Objective-C

    - (BOOL)satisfiesConstraintsForElement:(id)element
                                     error:(NSError **)errorOrNilPtr;

    Swift

    func satisfiesConstraints(forElement element: Any!, error errorOrNilPtr: Any!) -> Any!

    Parameters

    element

    A UI element being checked for the @c constraints. @param[out] errorOrNilPtr Error stored when an element did not satisfy the @c constraints. If an error is set but this pointer is @c nil, then an action failed exception is thrown.

    errorOrNilPtr

    Return Value

    @c YES if the constraints are satisfied on the element. @c NO otherwise.