public class Until


The Until class provides factory methods for constructing common conditions.

Summary

Public methods

static @NonNull UiObject2Condition<Boolean>
checkable(boolean isCheckable)

Returns a condition that depends on a UiObject2's checkable state.

static @NonNull UiObject2Condition<Boolean>
checked(boolean isChecked)

Returns a condition that depends on a UiObject2's checked state.

static @NonNull UiObject2Condition<Boolean>
clickable(boolean isClickable)

Returns a condition that depends on a UiObject2's clickable state.

static @NonNull UiObject2Condition<Boolean>

Returns a condition that is satisfied when the object's content description contains the given string (case-sensitive).

static @NonNull UiObject2Condition<Boolean>

Returns a condition that is satisfied when the object's content description ends with the given string (case-sensitive).

static @NonNull UiObject2Condition<Boolean>
descEquals(@NonNull String contentDescription)

Returns a condition that is satisfied when the object's content description exactly matches the given string (case-sensitive).

static @NonNull UiObject2Condition<Boolean>

Returns a condition that is satisfied when the object's content description matches the given regex.

static @NonNull UiObject2Condition<Boolean>

Returns a condition that is satisfied when the object's content description matches the given regex.

static @NonNull UiObject2Condition<Boolean>

Returns a condition that is satisfied when the object's content description starts with the given string (case-sensitive).

static @NonNull UiObject2Condition<Boolean>
enabled(boolean isEnabled)

Returns a condition that depends on a UiObject2's enabled state.

static @NonNull SearchCondition<UiObject2>

Returns a SearchCondition that is satisfied when at least one element matching the selector can be found.

static @NonNull SearchCondition<List<UiObject2>>

Returns a SearchCondition that is satisfied when at least one element matching the selector can be found.

static @NonNull UiObject2Condition<Boolean>
focusable(boolean isFocusable)

Returns a condition that depends on a UiObject2's focusable state.

static @NonNull UiObject2Condition<Boolean>
focused(boolean isFocused)

Returns a condition that depends on a UiObject2's focused state.

static @NonNull SearchCondition<Boolean>
gone(@NonNull BySelector selector)

Returns a SearchCondition that is satisfied when no elements matching the selector can be found.

static @NonNull SearchCondition<Boolean>

Returns a SearchCondition that is satisfied when at least one element matching the selector can be found.

static @NonNull UiObject2Condition<Boolean>
longClickable(boolean isLongClickable)

Returns a condition that depends on a UiObject2's long clickable state.

static @NonNull EventCondition<Boolean>

Returns a condition that depends on a new window having appeared.

static @NonNull EventCondition<Boolean>

Returns a condition that depends on a scroll having reached the end in the given direction.

static @NonNull UiObject2Condition<Boolean>
scrollable(boolean isScrollable)

Returns a condition that depends on a UiObject2's scrollable state.

static @NonNull UiObject2Condition<Boolean>
selected(boolean isSelected)

Returns a condition that depends on a UiObject2's selected state.

static @NonNull UiObject2Condition<Boolean>

Returns a condition that is satisfied when the object's text value contains the given string (case-sensitive).

static @NonNull UiObject2Condition<Boolean>

Returns a condition that is satisfied when the object's text value ends with the given string (case-sensitive).

static @NonNull UiObject2Condition<Boolean>

Returns a condition that is satisfied when the object's text value exactly matches the given string (case-sensitive).

static @NonNull UiObject2Condition<Boolean>

Returns a condition that is satisfied when the object's text value matches the given regex.

static @NonNull UiObject2Condition<Boolean>

Returns a condition that is satisfied when the object's text value matches the given regex.

static @NonNull UiObject2Condition<Boolean>

Returns a condition that is satisfied when the object's text value does not match the given string.

static @NonNull UiObject2Condition<Boolean>

Returns a condition that is satisfied when the object's text value starts with the given string (case-sensitive).

Public methods

checkable

Added in 2.2.0
public static @NonNull UiObject2Condition<Boolean> checkable(boolean isCheckable)

Returns a condition that depends on a UiObject2's checkable state.

Parameters
boolean isCheckable

Whether the object should be checkable to satisfy this condition.

checked

Added in 2.2.0
public static @NonNull UiObject2Condition<Boolean> checked(boolean isChecked)

Returns a condition that depends on a UiObject2's checked state.

Parameters
boolean isChecked

Whether the object should be checked to satisfy this condition.

clickable

Added in 2.2.0
public static @NonNull UiObject2Condition<Boolean> clickable(boolean isClickable)

Returns a condition that depends on a UiObject2's clickable state.

Parameters
boolean isClickable

Whether the object should be clickable to satisfy this condition.

descContains

Added in 2.2.0
public static @NonNull UiObject2Condition<Boolean> descContains(@NonNull String substring)

Returns a condition that is satisfied when the object's content description contains the given string (case-sensitive).

descEndsWith

Added in 2.2.0
public static @NonNull UiObject2Condition<Boolean> descEndsWith(@NonNull String substring)

Returns a condition that is satisfied when the object's content description ends with the given string (case-sensitive).

descEquals

Added in 2.2.0
public static @NonNull UiObject2Condition<Boolean> descEquals(@NonNull String contentDescription)

Returns a condition that is satisfied when the object's content description exactly matches the given string (case-sensitive).

descMatches

Added in 2.2.0
public static @NonNull UiObject2Condition<Boolean> descMatches(@NonNull Pattern regex)

Returns a condition that is satisfied when the object's content description matches the given regex.

descMatches

Added in 2.2.0
public static @NonNull UiObject2Condition<Boolean> descMatches(@NonNull String regex)

Returns a condition that is satisfied when the object's content description matches the given regex.

descStartsWith

Added in 2.2.0
public static @NonNull UiObject2Condition<Boolean> descStartsWith(@NonNull String substring)

Returns a condition that is satisfied when the object's content description starts with the given string (case-sensitive).

enabled

Added in 2.2.0
public static @NonNull UiObject2Condition<Boolean> enabled(boolean isEnabled)

Returns a condition that depends on a UiObject2's enabled state.

Parameters
boolean isEnabled

Whether the object should be enabled to satisfy this condition.

findObject

Added in 2.2.0
public static @NonNull SearchCondition<UiObject2> findObject(@NonNull BySelector selector)

Returns a SearchCondition that is satisfied when at least one element matching the selector can be found. The condition will return the first matching element.

findObjects

Added in 2.2.0
public static @NonNull SearchCondition<List<UiObject2>> findObjects(@NonNull BySelector selector)

Returns a SearchCondition that is satisfied when at least one element matching the selector can be found. The condition will return all matching elements.

focusable

Added in 2.2.0
public static @NonNull UiObject2Condition<Boolean> focusable(boolean isFocusable)

Returns a condition that depends on a UiObject2's focusable state.

Parameters
boolean isFocusable

Whether the object should be focusable to satisfy this condition.

focused

Added in 2.2.0
public static @NonNull UiObject2Condition<Boolean> focused(boolean isFocused)

Returns a condition that depends on a UiObject2's focused state.

Parameters
boolean isFocused

Whether the object should be focused to satisfy this condition.

gone

Added in 2.2.0
public static @NonNull SearchCondition<Boolean> gone(@NonNull BySelector selector)

Returns a SearchCondition that is satisfied when no elements matching the selector can be found.

hasObject

Added in 2.2.0
public static @NonNull SearchCondition<Boolean> hasObject(@NonNull BySelector selector)

Returns a SearchCondition that is satisfied when at least one element matching the selector can be found.

longClickable

Added in 2.2.0
public static @NonNull UiObject2Condition<Boolean> longClickable(boolean isLongClickable)

Returns a condition that depends on a UiObject2's long clickable state.

Parameters
boolean isLongClickable

Whether the object should be long clickable to satisfy this condition.

newWindow

Added in 2.2.0
public static @NonNull EventCondition<Boolean> newWindow()

Returns a condition that depends on a new window having appeared.

scrollFinished

Added in 2.2.0
public static @NonNull EventCondition<Boolean> scrollFinished(@NonNull Direction direction)

Returns a condition that depends on a scroll having reached the end in the given direction.

Parameters
@NonNull Direction direction

The direction of the scroll.

scrollable

Added in 2.2.0
public static @NonNull UiObject2Condition<Boolean> scrollable(boolean isScrollable)

Returns a condition that depends on a UiObject2's scrollable state.

Parameters
boolean isScrollable

Whether the object should be scrollable to satisfy this condition.

selected

Added in 2.2.0
public static @NonNull UiObject2Condition<Boolean> selected(boolean isSelected)

Returns a condition that depends on a UiObject2's selected state.

Parameters
boolean isSelected

Whether the object should be selected to satisfy this condition.

textContains

Added in 2.2.0
public static @NonNull UiObject2Condition<Boolean> textContains(@NonNull String substring)

Returns a condition that is satisfied when the object's text value contains the given string (case-sensitive).

textEndsWith

Added in 2.2.0
public static @NonNull UiObject2Condition<Boolean> textEndsWith(@NonNull String substring)

Returns a condition that is satisfied when the object's text value ends with the given string (case-sensitive).

textEquals

Added in 2.2.0
public static @NonNull UiObject2Condition<Boolean> textEquals(@NonNull String text)

Returns a condition that is satisfied when the object's text value exactly matches the given string (case-sensitive).

textMatches

Added in 2.2.0
public static @NonNull UiObject2Condition<Boolean> textMatches(@NonNull Pattern regex)

Returns a condition that is satisfied when the object's text value matches the given regex.

textMatches

Added in 2.2.0
public static @NonNull UiObject2Condition<Boolean> textMatches(@NonNull String regex)

Returns a condition that is satisfied when the object's text value matches the given regex.

textNotEquals

Added in 2.2.0
public static @NonNull UiObject2Condition<Boolean> textNotEquals(@NonNull String text)

Returns a condition that is satisfied when the object's text value does not match the given string.

textStartsWith

Added in 2.2.0
public static @NonNull UiObject2Condition<Boolean> textStartsWith(@NonNull String substring)

Returns a condition that is satisfied when the object's text value starts with the given string (case-sensitive).