onView(ViewMatcher) .perform(ViewAction) .check(ViewAssertion);

onData(ObjectMatcher) .DataOptions .perform(ViewAction) .check(ViewAssertion);

Data Options

View Matchers USER PROPERTIES withId(...) withText(...) withTagKey(...) withTagValue(...) hasContentDescription(...) withContentDescription(...) withHint(...) withSpinnerText(...) hasLinks() hasEllipsizedText() hasMultilineTest()

inAdapterView(Matcher) atPosition(Integer) onChildView(Matcher)

HIERARCHY withParent(Matcher) withChild(Matcher) hasDescendant(Matcher) isDescendantOfA(Matcher) hasSibling(Matcher) isRoot()

View Actions

INPUT supportsInputMethods(...) hasIMEAction(...)

UI PROPERTIES

CLASS

isDisplayed() isCompletelyDisplayed() isEnabled() hasFocus() isClickable() isChecked() isNotChecked() withEffectiveVisibility(...) isSelected()

isAssignableFrom(...) withClassName(...)

ROOT MATCHERS

CLICK/PRESS

GESTURES

click() doubleClick() longClick() pressBack() pressIMEActionButton() pressKey([int/EspressoKey]) pressMenuKey() closeSoftKeyboard() openLink()

scrollTo() swipeLeft() swipeRight() swipeUp() swipeDown()

isFocusable() isTouchable() isDialog() withDecorView() isPlatformPopup()

TEXT clearText() typeText(String) typeTextIntoFocusedView(String) replaceText(String)

OBJECT MATCHER allOf(Matchers) anyOf(Matchers) is(...) not(...) endsWith(String) startsWith(String) instanceOf(Class)

View Assertions

SEE ALSO Preference matchers Cursor matchers Layout matchers

matches(Matcher) doesNotExist() selectedDescendantsMatch(...)

LAYOUT ASSERTIONS noEllipseizedText(Matcher) noMultilineButtons() noOverlaps([Matcher])

intended(IntentMatcher);

POSITION ASSERTIONS isLeftOf(Matcher) isRightOf(Matcher) isLeftAlignedWith(Matcher) isRightAlignedWith(Matcher) isAbove(Matcher) isBelow(Matcher) isBottomAlignedWith(Matcher) isTopAlignedWith(Matcher)

intending(IntentMatcher) .respondWith(ActivityResult);

Intent Matchers INTENT

URI

BUNDLE

hasAction(...) hasCategories(...) hasData(...) hasComponent(...) hasExtra(...) hasExtras(Matcher) hasExtraWithKey(...) hasType(...) hasPackage() toPackage(String) hasFlag(int) hasFlags(...) isInternal()

hasHost(...) hasParamWithName(...) hasPath(...) hasParamWithValue(...) hasScheme(...) hasSchemeSpecificPart(...)

hasEntry(...) hasKey(...) hasValue(...)

COMPONENT NAME hasClassName(...) hasPackageName(...) hasShortClassName(...) hasMyPackageName()

v2.1.0, 4/21/2015

espresso-cheat-sheet-2.1.0.pdf

There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item.

90KB Sizes 14 Downloads 201 Views

Recommend Documents

No documents