public class ComponentHostMatchers extends Object
ComponentHost
.Modifier and Type | Method and Description |
---|---|
static <any> |
componentHost() |
static <any> |
componentHost(<any> subMatcher)
Matches a view that is a ComponentHost that matches subMatcher.
|
static <any> |
componentHostWithText(<any> textMatcher)
Matches a ComponentHost which is displaying text that matches
textMatcher |
static <any> |
componentHostWithText(String text)
Matches a ComponentHost which is displaying
text . |
static <any> |
isClickable() |
static <any> |
withContentDescription(<any> textMatcher) |
static <any> |
withContentDescription(CharSequence text) |
static <any> |
withLifecycle(<any> lifecycleMatcher)
Matches a ComponentHost that has mounted a Component with a lifecycle that's matched by the
lifecycleMatcher . |
static <any> |
withTagKey(int key) |
static <any> |
withTagKey(int key,
<any> value) |
static <any> |
withTagValue(<any> value) |
static <any> |
withText(<any> textMatcher) |
static <any> |
withText(String text) |
public static <any> componentHost(<any> subMatcher)
In Espresso tests, when you need to match a View, we recommend using this matcher and nest
any of the other matchers in this class along with it. For example
componentHost(withText("foobar"))
or
componentHost(withContentDescription("foobar"))
.
While it's definitely possible to use Espresso's ViewMatchers directly to match ComponentHosts, using these methods ensure that we can handle weirdness in the view hierarchy that comes from the component stack.
public static <any> withLifecycle(<any> lifecycleMatcher)
lifecycleMatcher
.public static <any> componentHostWithText(<any> textMatcher)
textMatcher
public static <any> withText(<any> textMatcher)
public static <any> componentHostWithText(String text)
text
. This is equivalent to componentHostWithText(is(text))
.public static <any> withText(String text)
public static <any> withContentDescription(CharSequence text)
public static <any> withContentDescription(<any> textMatcher)
public static <any> withTagValue(<any> value)
public static <any> withTagKey(int key)
public static <any> withTagKey(int key, <any> value)
public static <any> isClickable()
public static <any> componentHost()