3.1 Interaction APIs

2018-01-03  本文已影响0人  冰皮月饼真好吃

1 Selecting an element to interact with,

2 Performing an action on it, and/or

3 Making an assertion to verify state and behavior.

EarlGrey Matchers:

grey_accessibilityID() / grey_accessibilityTrait() / grey_accessibilityLabel()

grey_sufficientlyVisible()

grey_allOf(), grey_anyOf(), grey_not()                    

Custom Matchers

To create custom matchers, use the block-based GREYElementMatcherBlock class.

Selecting Off-Screen UI Elements

In certain situations the UI element may be hidden off-screen, and may require certain interactions to bring it onto the screen.use the [usingSearchAction:onElementWithMatcher:] method to provide a search action for such elements[[[EarlGrey selectElementWithMatcher:aButtonMatcher]

    usingSearchAction:grey_scrollInDirection(kGREYDirectionDown, 50)

onElementWithMatcher:aScrollViewMatcher]

    performAction:grey_tap()];

[[[EarlGrey selectElementWithMatcher:aCellMatcher]

    usingSearchAction:grey_scrollInDirection(kGREYDirectionUp, 50)

onElementWithMatcher:aTableViewMatcher]

    performAction:grey_tap()];

上一篇 下一篇

猜你喜欢

热点阅读