GREYAssertion

@protocol GREYAssertion <NSObject>

Protocol to which EarlGrey assertion classes must conform.

  • Checks whether the assertion is valid for the provided @c element, throwing an exception if the if the assertion fails and the @c errorOrNil parameter is @c nil. If a non-nil @c errorOrNil is provided, it will be set to error that represents the assertion failure cause. If the assertion does not accept @c nil elements, the error domain should be @c kGREYInteractionErrorDomain and the error code @c kGREYInteractionElementNotFoundErrorCode. GREYAssertionDefines.h defines macros for throwing common exception types.

    @throws NSException If the assertion fails and the provided @c errorOrNil is @c nil. The specific type depends on the implementation.

    Declaration

    Objective-C

    - (BOOL)assert:(id)element error:(NSError **)errorOrNil;

    Swift

    func assert(_ element: Any!, error errorOrNil: UnsafeMutablePointer

    Parameters

    element

    Element on which the assertion should be checked. @param[out] errorOrNil If non-nil, set to the cause of the assertion failure.

    errorOrNil

    Return Value

    @c YES if the assertion holds for the specified element, @c NO otherwise.

  • Declaration

    Objective-C

    - (NSString *)name;

    Swift

    func name() -> String!

    Return Value

    The name of the assertion.