| java.lang.Object | |
| ↳ | android.support.test.espresso.matcher.ViewMatchers | 
A collection of hamcrest matchers that match Views.
| Nested Classes | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| ViewMatchers.Visibility | Enumerates the possible list of values for View.getVisibility(). | ||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| 
          A replacement for MatcherAssert.assertThat that renders View objects nicely.
         | |||||||||||
| 
          A replacement for MatcherAssert.assertThat that renders View objects nicely.
         | |||||||||||
| 
          Returns a matcher that matches  Views based on the presence of a descendant in its view
 hierarchy. | |||||||||||
| 
          Returns a matcher that matches  Views currently have focus. | |||||||||||
| 
          Returns a matcher that matches views that support input methods (e.g.
         | |||||||||||
| 
          Returns a matcher that matches views that support input methods (e.g.
         | |||||||||||
| 
          Returns a matcher that matches  TextViews that have links. | |||||||||||
| 
          Returns a matcher that matches Views which are an instance of or subclass of the provided
 class.
         | |||||||||||
| 
          Returns a matcher that accepts if and only if the view is a CompoundButton (or subtype of) and
 is in checked state.
         | |||||||||||
| 
          Returns a matcher that matches  Views that are clickable. | |||||||||||
| 
          Returns a matcher which only accepts a view whose height and width fit perfectly within
 the currently displayed region of this view.
         | |||||||||||
| 
          Returns a matcher that matches  Views based on the given ancestor type. | |||||||||||
| 
          Returns a matcher that matches  Views that are currently displayed on the screen to the
 user. | |||||||||||
| 
          Returns a matcher which accepts a view so long as a given percentage of that view's area is
 not obscured by any other view and is thus visible to the user.
         | |||||||||||
| 
          Returns a matcher that matches  Views that are enabled. | |||||||||||
| 
          Returns a matcher that matches  Views that are focusable. | |||||||||||
| 
          Returns a matcher that matches  WebViewif they are evaluating Javascript. | |||||||||||
| 
          Returns a matcher that accepts if and only if the view is a CompoundButton (or subtype of) and
 is not in checked state.
         | |||||||||||
| 
          Returns a matcher that matches root  View. | |||||||||||
| 
          Returns a matcher that matches  Views that are selected. | |||||||||||
| 
          Returns a matcher that matches views that support input methods.
         | |||||||||||
| 
          A matcher that returns true if and only if the view's child is accepted by the provided
 matcher.
         | |||||||||||
| 
          Returns a matcher that matches Views with class name matching the given matcher.
         | |||||||||||
| 
          Returns a matcher that matches  Views that have "effective" visibility set to the given
 value. | |||||||||||
| 
          Returns a matcher that matches a descendant of  TextViewthat is displaying the hint
 associated with the given resource id. | |||||||||||
| 
          Returns a matcher that matches  TextViews based on hint property value. | |||||||||||
| 
          Returns a matcher that matches  TextViewbased on it's hint property value. | |||||||||||
| 
          Returns a matcher that matches  Views based on resource ids. | |||||||||||
| 
          Same as withId(is(int)), but attempts to look up resource name of the given id and use an
 R.id.myView style description with describeTo.
         | |||||||||||
| 
          A matcher that accepts a view if and only if the view's parent is accepted by the provided
 matcher.
         | |||||||||||
| 
          Returns a matcher that matches  Spinnerbased on it's selected item's toString value. | |||||||||||
| 
          Returns a matcher that matches a descendant of  Spinnerthat is displaying the string
 of the selected item associated with the given resource id. | |||||||||||
| 
          Returns a matcher that matches  Spinners based on toString value of the selected item. | |||||||||||
| 
          Returns a matcher that matches  Views based on tag keys. | |||||||||||
| 
          Returns a matcher that matches  Viewbased on tag keys. | |||||||||||
| 
          Returns a matcher that matches  Views based on tag property values. | |||||||||||
| 
          Returns a matcher that matches  TextViewbased on its text property value. | |||||||||||
| 
          Returns a matcher that matches  TextViews based on text property value. | |||||||||||
| 
          Returns a matcher that matches a descendant of  TextViewthat is displaying the string
 associated with the given resource id. | |||||||||||
| [Expand] Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|  From class
  java.lang.Object | |||||||||||
A replacement for MatcherAssert.assertThat that renders View objects nicely.
| message | the message to display. | 
|---|---|
| actual | the actual value. | 
| matcher | a matcher that accepts or rejects actual. | 
A replacement for MatcherAssert.assertThat that renders View objects nicely.
| actual | the actual value. | 
|---|---|
| matcher | a matcher that accepts or rejects actual. | 
Returns a matcher that matches Views based on the presence of a descendant in its view
 hierarchy.
| descendantMatcher | the type of the descendant to match on | 
|---|
Returns a matcher that matches views that support input methods (e.g. EditText) and have the
 specified IME action set in its EditorInfo.
| imeAction | the IME action to match | 
|---|
Returns a matcher that matches views that support input methods (e.g. EditText) and have the
 specified IME action set in its EditorInfo.
| imeActionMatcher | a matcher for the IME action | 
|---|
Returns an 
 Matcher that matches Views based on their siblings.
 
 This may be particularly useful when a view cannot be uniquely selected on properties such as
 text or R.id. For example: a call button is repeated several times in a contacts layout and the
 only way to differentiate the call button view is by what appears next to it (e.g. the unique
 name of the contact).
| siblingMatcher | a Matcherfor the sibling of the view. | 
|---|
Returns a matcher that matches Views which are an instance of or subclass of the provided class. Some versions of Hamcrest make the generic typing of this a nightmare, so we have a special case for our users.
Returns a matcher that accepts if and only if the view is a CompoundButton (or subtype of) and is in checked state.
Returns a matcher which only accepts a view whose height and width fit perfectly within the currently displayed region of this view. There exist views (such as ScrollViews) whose height and width are larger then the physical device screen by design. Such views will _never_ be completely displayed.
Returns a matcher that matches Views based on the given ancestor type.
| ancestorMatcher | the type of the ancestor to match on | 
|---|
Returns a matcher that matches Views that are currently displayed on the screen to the
 user.
 Note: isDisplayed will select views that are partially displayed (eg: the full height/width of
 the view is greater then the height/width of the visible rectangle). If you wish to ensure the
 entire rectangle this view draws is displayed to the user use isCompletelyDisplayed.
Returns a matcher which accepts a view so long as a given percentage of that view's area is not obscured by any other view and is thus visible to the user.
| areaPercentage | an integer ranging from (0, 100] indicating how much percent of the surface area of the view must be shown to the user to be accepted. | 
|---|
Returns a matcher that matches WebView if they are evaluating Javascript.
Returns a matcher that accepts if and only if the view is a CompoundButton (or subtype of) and is not in checked state.
Returns a matcher that matches views that support input methods.
A matcher that returns true if and only if the view's child is accepted by the provided matcher.
| childMatcher | the matcher to apply on the child views. | 
|---|
Returns a matcher that matches Views with class name matching the given matcher.
| charSequenceMatcher | a CharSequenceMatcherfor the content description | 
|---|
Returns a matcher that matches Views that have "effective" visibility set to the given
 value. Effective visibility takes into account not only the view's visibility value, but also
 that of its ancestors. In case of View.VISIBLE, this means that the view and all of its
 ancestors have visibility=VISIBLE. In case of GONE and INVISIBLE, it's the opposite - any GONE
 or INVISIBLE parent will make all of its children have their effective visibility.
 
Note: Contrary to what the name may imply, view visibility does not directly translate into whether the view is displayed on screen (use isDisplayed() for that). For example, the view and all of its ancestors can have visibility=VISIBLE, but the view may need to be scrolled to in order to be actually visible to the user. Unless you're specifically targeting the visibility value with your test, use isDisplayed.
Returns a matcher that matches a descendant of TextView that is displaying the hint
 associated with the given resource id.
| resourceId | the string resource the text view is expected to have as a hint. | 
|---|
Returns a matcher that matches Views based on resource ids. Note: Android resource ids
 are not guaranteed to be unique. You may have to pair this matcher with another one to
 guarantee a unique view selection.
| integerMatcher | a Matcher for resource ids | 
|---|
Same as withId(is(int)), but attempts to look up resource name of the given id and use an R.id.myView style description with describeTo. If resource lookup is unavailable, at the time describeTo is invoked, this will print out a simple "with id: %d". If resource lookup is available, but looking up the name for the given id, fails, "with id: %d (resource name not found)" will be returned as the description.
| id | the resource id. | 
|---|
A matcher that accepts a view if and only if the view's parent is accepted by the provided matcher.
| parentMatcher | the matcher to apply on getParent. | 
|---|
Returns a matcher that matches Spinner based on it's selected item's toString value.
 
Note: Sugar for withSpinnerText(is("string")).
Returns a matcher that matches a descendant of Spinner that is displaying the string
 of the selected item associated with the given resource id.
| resourceId | the string resource the text view is expected to hold. | 
|---|
Returns a matcher that matches Views based on tag keys.
| key | to match | 
|---|---|
| objectMatcher | Object to match | 
Returns a matcher that matches View based on tag keys.
| key | to match | 
|---|
Returns a matcher that matches Views based on tag property values.
| tagValueMatcher | a Matcher for the view's tag property value | 
|---|
Returns a matcher that matches a descendant of TextView that is displaying the string
 associated with the given resource id.
| resourceId | the string resource the text view is expected to hold. | 
|---|