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

public static @NonNull UiObject2Condition<Booleancheckable(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

public static @NonNull UiObject2Condition<Booleanchecked(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

public static @NonNull UiObject2Condition<Booleanclickable(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

public static @NonNull UiObject2Condition<BooleandescContains(@NonNull String substring)

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

descEndsWith

public static @NonNull UiObject2Condition<BooleandescEndsWith(@NonNull String substring)

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

descEquals

public static @NonNull UiObject2Condition<BooleandescEquals(@NonNull String contentDescription)

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

descMatches

public static @NonNull UiObject2Condition<BooleandescMatches(@NonNull Pattern regex)

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

descMatches

public static @NonNull UiObject2Condition<BooleandescMatches(@NonNull String regex)

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

descStartsWith

public static @NonNull UiObject2Condition<BooleandescStartsWith(@NonNull String substring)

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

enabled

public static @NonNull UiObject2Condition<Booleanenabled(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

public static @NonNull SearchCondition<UiObject2findObject(@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

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

public static @NonNull UiObject2Condition<Booleanfocusable(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

public static @NonNull UiObject2Condition<Booleanfocused(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

public static @NonNull SearchCondition<Booleangone(@NonNull BySelector selector)

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

hasObject

public static @NonNull SearchCondition<BooleanhasObject(@NonNull BySelector selector)

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

longClickable

public static @NonNull UiObject2Condition<BooleanlongClickable(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

public static @NonNull EventCondition<BooleannewWindow()

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

scrollFinished

public static @NonNull EventCondition<BooleanscrollFinished(@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

public static @NonNull UiObject2Condition<Booleanscrollable(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

public static @NonNull UiObject2Condition<Booleanselected(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

public static @NonNull UiObject2Condition<BooleantextContains(@NonNull String substring)

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

textEndsWith

public static @NonNull UiObject2Condition<BooleantextEndsWith(@NonNull String substring)

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

textEquals

public static @NonNull UiObject2Condition<BooleantextEquals(@NonNull String text)

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

textMatches

public static @NonNull UiObject2Condition<BooleantextMatches(@NonNull Pattern regex)

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

textMatches

public static @NonNull UiObject2Condition<BooleantextMatches(@NonNull String regex)

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

textNotEquals

public static @NonNull UiObject2Condition<BooleantextNotEquals(@NonNull String text)

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

textStartsWith

public static @NonNull UiObject2Condition<BooleantextStartsWith(@NonNull String substring)

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