ViewPredicates

A collection of useful predicates over Android views for tests

Functions

Link copied to clipboard

Tries to extract the description of a drawn drawable from a canvas (legacy graphics mode)

Link copied to clipboard
fun hasAccessibilityRole(accessibilityRole: String): Predicate<View>
Link copied to clipboard
fun hasContentDescription(contentDescription: String): Predicate<View>
Link copied to clipboard
fun hasDrawable(drawable: Drawable): Predicate<View>
Link copied to clipboard
fun hasId(id: Int): Predicate<View>
Link copied to clipboard
fun hasTag(tagId: Int, tagValue: Any): Predicate<View>
Link copied to clipboard
fun hasText(text: String): Predicate<View>

Returns a predicate that returns true if the applied on view's text is equal to the given text. substring.

Link copied to clipboard
fun hasTextMatchingPredicate(predicate: Predicate<String>): Predicate<View>

Returns a predicate that returns true if the applied on view's text is equal to the given text. substring.

Link copied to clipboard
fun hasVisibleDrawable(drawable: Drawable): Predicate<View>
Link copied to clipboard
fun hasVisibleId(viewId: Int): Predicate<View>
Link copied to clipboard
Link copied to clipboard
fun hasVisibleText(text: String): Predicate<View>
Link copied to clipboard
fun hasVisibleTextWithTag(text: String, tagId: Int, tagValue: Any): Predicate<View>
Link copied to clipboard
fun isClass(clazz: Class<out View>): Predicate<View>
Link copied to clipboard
fun isVisible(): Predicate<View>
Link copied to clipboard
fun matchesText(text: String): Predicate<View>