ViewTreeAssert

class ViewTreeAssert : AbstractAssert<ViewTreeAssert, ViewTree>

Assertions which require checking an entire view tree

NOTE: Assertions looking for visible attributes are limited to checking the visibility of the nodes, but do not check actual layout. So a visible view might have 0 pixels available for it in actual app code and still pass the checks done here

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
var info: WritableAssertionInfo

Functions

Link copied to clipboard
open fun actual(): ViewTree
Link copied to clipboard
open fun as(descriptionSupplier: Supplier<String>): ViewTreeAssert
open fun as(description: Description): ViewTreeAssert
open fun as(description: String, vararg args: Any): ViewTreeAssert
Link copied to clipboard
open override fun <ASSERT : AbstractAssert<*, *>> asInstanceOf(instanceOfAssertFactory: InstanceOfAssertFactory<*, ASSERT>): ASSERT
Link copied to clipboard
open override fun asList(): AbstractListAssert<*, MutableList<*>, Any, ObjectAssert<Any>>
Link copied to clipboard
open override fun asString(): AbstractStringAssert<*>
Link copied to clipboard
open override fun describedAs(description: Description): ViewTreeAssert
open fun describedAs(descriptionSupplier: Supplier<String>): ViewTreeAssert
open fun describedAs(description: String, vararg args: Any): ViewTreeAssert
Link copied to clipboard
Link copied to clipboard
open override fun doesNotHave(condition: Condition<in ViewTree>): ViewTreeAssert
Link copied to clipboard
open override fun doesNotHaveSameClassAs(other: Any): ViewTreeAssert
Link copied to clipboard
open override fun doesNotHaveSameHashCodeAs(other: Any): ViewTreeAssert
Link copied to clipboard
open override fun doesNotHaveToString(otherToString: String): ViewTreeAssert
open override fun doesNotHaveToString(expectedStringTemplate: String, vararg args: Any): ViewTreeAssert
Link copied to clipboard
fun <V : View> doesNotHaveVisible(clazz: Class<V>, predicate: Predicate<Any>): ViewTreeAssert
Link copied to clipboard

Tests all views in the hierarchy under the root, for which the path is visible, are not displaying the requested drawable

Tests all views in the hierarchy under the root, for which the path is visible, do not have the requested drawable by the given resource id. For this assertion to work, Robolectric must be immediately available and be able to load the drawable corresponding to this resource id.

Link copied to clipboard

Tests that all views in the hierarchy under the root, for which the path is visible, do not have any text appearing on them

Tests that all views in the hierarchy under the root, for which the path is visible, do not have text equal to the string matching the given resource id

Tests that all views in the hierarchy under the root, for which the path is visible, do not have text equal to the given string

Link copied to clipboard

Tests that all views in the hierarchy under the root, for which the path is visible, do not have text that matches against the given regular expression

Link copied to clipboard

Whether there is not a visible view in the hierarchy with the given id.

Link copied to clipboard
open fun doesNotMatch(predicate: Predicate<in ViewTree>): ViewTreeAssert
open fun doesNotMatch(predicate: Predicate<in ViewTree>, predicateDescription: String): ViewTreeAssert
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open fun getWritableAssertionInfo(): WritableAssertionInfo
Link copied to clipboard
open override fun has(condition: Condition<in ViewTree>): ViewTreeAssert
Link copied to clipboard
fun hasAccessibilityRole(accessibilityRole: String): ViewTreeAssert

Tests if any view hierarchy under the root has the given accessibility role.

Link copied to clipboard
fun hasContentDescription(contentDescription: String): ViewTreeAssert

Tests if any view hierarchy under the root has the given contentDescription.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard

Tests if any view hierarchy under the root do not has the given contentDescription.

Link copied to clipboard
open override fun hasSameClassAs(other: Any): ViewTreeAssert
Link copied to clipboard
open override fun hasSameHashCodeAs(other: Any): ViewTreeAssert
Link copied to clipboard
open override fun hasToString(expectedToString: String): ViewTreeAssert
open override fun hasToString(expectedStringTemplate: String, vararg args: Any): ViewTreeAssert
Link copied to clipboard
fun hasViewTag(tagId: Int, tagValue: Any): ViewTreeAssert

Tests if any view hierarchy under the root has the given view tag and value.

Link copied to clipboard
fun <V : View> hasVisible(clazz: Class<V>, predicate: Predicate<V>): ViewTreeAssert
Link copied to clipboard

Tests if any view in the hierarchy under the root, for which the path is visible, is displaying the requested drawable

Tests if any view in the hierarchy under the root, for which the path is visible, is displaying the requested drawable by the given resource id.

Link copied to clipboard

Tests if any view has visible text identified by the resource id

Tests if any view in the hierarchy under the root, for which the path is visible, has the requested piece of text as its text

Link copied to clipboard

Tests if any view in the hierarchy under the root, for which the path is visible, has text that matches the given regular expression

Link copied to clipboard
fun hasVisibleTextWithTag(text: String, tagId: Int, tagValue: Any): ViewTreeAssert

Tests if any view in the hierarchy under the root, for which the path is visible, has the requested piece of text as its text and has a tag set on that TextView with the given tag id and tag value.

Link copied to clipboard

Whether there is a visible view in the hierarchy with the given id.

Link copied to clipboard
open override fun is(condition: Condition<in ViewTree>): ViewTreeAssert
Link copied to clipboard
open override fun isEqualTo(expected: Any): ViewTreeAssert
Link copied to clipboard
open override fun isExactlyInstanceOf(type: Class<*>): ViewTreeAssert
Link copied to clipboard
open override fun isIn(vararg values: Any): ViewTreeAssert
open override fun isIn(values: MutableIterable<*>): ViewTreeAssert
Link copied to clipboard
open override fun isInstanceOf(type: Class<*>): ViewTreeAssert
Link copied to clipboard
open override fun isInstanceOfAny(vararg types: Class<*>): ViewTreeAssert
Link copied to clipboard
open override fun <T : Any> isInstanceOfSatisfying(type: Class<T>, requirements: Consumer<T>): ViewTreeAssert
Link copied to clipboard
open override fun isNot(condition: Condition<in ViewTree>): ViewTreeAssert
Link copied to clipboard
open override fun isNotEqualTo(other: Any): ViewTreeAssert
Link copied to clipboard
open override fun isNotExactlyInstanceOf(type: Class<*>): ViewTreeAssert
Link copied to clipboard
open override fun isNotIn(vararg values: Any): ViewTreeAssert
open override fun isNotIn(values: MutableIterable<*>): ViewTreeAssert
Link copied to clipboard
open override fun isNotInstanceOf(type: Class<*>): ViewTreeAssert
Link copied to clipboard
open override fun isNotInstanceOfAny(vararg types: Class<*>): ViewTreeAssert
Link copied to clipboard
open override fun isNotNull(): ViewTreeAssert
Link copied to clipboard
open override fun isNotOfAnyClassIn(vararg types: Class<*>): ViewTreeAssert
Link copied to clipboard
open override fun isNotSameAs(other: Any): ViewTreeAssert
Link copied to clipboard
open override fun isNull()
Link copied to clipboard
open override fun isOfAnyClassIn(vararg types: Class<*>): ViewTreeAssert
Link copied to clipboard
open override fun isSameAs(expected: Any): ViewTreeAssert
Link copied to clipboard
open fun matches(predicate: Predicate<in ViewTree>): ViewTreeAssert
open fun matches(predicate: Predicate<in ViewTree>, predicateDescription: String): ViewTreeAssert
Link copied to clipboard
open fun overridingErrorMessage(newErrorMessage: String, vararg args: Any): ViewTreeAssert
Link copied to clipboard
fun satisfies(vararg requirements: Consumer<in ViewTree>): ViewTreeAssert
fun satisfies(vararg assertions: ThrowingConsumer<in ViewTree>): ViewTreeAssert
open override fun satisfies(condition: Condition<in ViewTree>): ViewTreeAssert
Link copied to clipboard
fun satisfiesAnyOf(vararg assertions: ThrowingConsumer<in ViewTree>): ViewTreeAssert
Link copied to clipboard
open override fun usingComparator(customComparator: Comparator<in ViewTree>): ViewTreeAssert
open override fun usingComparator(customComparator: Comparator<in ViewTree>, customComparatorDescription: String): ViewTreeAssert
Link copied to clipboard
Link copied to clipboard
open override fun usingEquals(predicate: BiPredicate<in ViewTree, in ViewTree>): ViewTreeAssert
open override fun usingEquals(predicate: BiPredicate<in ViewTree, in ViewTree>, customEqualsDescription: String): ViewTreeAssert
Link copied to clipboard
open fun withFailMessage(newErrorMessage: String, vararg args: Any): ViewTreeAssert
Link copied to clipboard
open override fun withRepresentation(representation: Representation): ViewTreeAssert
Link copied to clipboard