Until

public class Until
extends Object

java.lang.Object
   ↳ android.support.test.uiautomator.Until


The Until class provides factory methods for constructing common conditions.

Summary

Public constructors

Until()

Public methods

static UiObject2Condition<Boolean> checkable(boolean isCheckable)

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

static UiObject2Condition<Boolean> checked(boolean isChecked)

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

static UiObject2Condition<Boolean> clickable(boolean isClickable)

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

static UiObject2Condition<Boolean> descContains(String substring)

Returns a condition that is satisfied when the object's content description contains the given string.

static UiObject2Condition<Boolean> descEndsWith(String substring)

Returns a condition that is satisfied when the object's content description ends with the given string.

static UiObject2Condition<Boolean> descEquals(String contentDescription)

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

static UiObject2Condition<Boolean> descMatches(String regex)

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

static UiObject2Condition<Boolean> descMatches(Pattern regex)

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

static UiObject2Condition<Boolean> descStartsWith(String substring)

Returns a condition that is satisfied when the object's content description starts with the given string.

static UiObject2Condition<Boolean> enabled(boolean isEnabled)

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

static SearchCondition<UiObject2> findObject(BySelector selector)

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

static SearchCondition<List<UiObject2>> findObjects(BySelector selector)

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

static UiObject2Condition<Boolean> focusable(boolean isFocusable)

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

static UiObject2Condition<Boolean> focused(boolean isFocused)

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

static SearchCondition<Boolean> gone(BySelector selector)

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

static SearchCondition<Boolean> hasObject(BySelector selector)

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

static UiObject2Condition<Boolean> longClickable(boolean isLongClickable)

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

static EventCondition<Boolean> newWindow()

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

static EventCondition<Boolean> scrollFinished(Direction direction)

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

static UiObject2Condition<Boolean> scrollable(boolean isScrollable)

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

static UiObject2Condition<Boolean> selected(boolean isSelected)

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

static UiObject2Condition<Boolean> textContains(String substring)

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

static UiObject2Condition<Boolean> textEndsWith(String substring)

Returns a condition that is satisfied when the object's text value ends with the given string.

static UiObject2Condition<Boolean> textEquals(String text)

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

static UiObject2Condition<Boolean> textMatches(String regex)

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

static UiObject2Condition<Boolean> textMatches(Pattern regex)

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

static UiObject2Condition<Boolean> textNotEquals(String text)
static UiObject2Condition<Boolean> textStartsWith(String substring)

Returns a condition that is satisfied when the object's text value starts with the given string.

Inherited methods

From class java.lang.Object

Public constructors

Until

Until ()

Public methods

checkable

UiObject2Condition<Boolean> checkable (boolean isCheckable)

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

Parameters
isCheckable boolean: Whether the object should be checkable to satisfy this condition.

Returns
UiObject2Condition<Boolean>

checked

UiObject2Condition<Boolean> checked (boolean isChecked)

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

Parameters
isChecked boolean: Whether the object should be checked to satisfy this condition.

Returns
UiObject2Condition<Boolean>

clickable

UiObject2Condition<Boolean> clickable (boolean isClickable)

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

Parameters
isClickable boolean: Whether the object should be clickable to satisfy this condition.

Returns
UiObject2Condition<Boolean>

descContains

UiObject2Condition<Boolean> descContains (String substring)

Returns a condition that is satisfied when the object's content description contains the given string.

Parameters
substring String

Returns
UiObject2Condition<Boolean>

descEndsWith

UiObject2Condition<Boolean> descEndsWith (String substring)

Returns a condition that is satisfied when the object's content description ends with the given string.

Parameters
substring String

Returns
UiObject2Condition<Boolean>

descEquals

UiObject2Condition<Boolean> descEquals (String contentDescription)

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

Parameters
contentDescription String

Returns
UiObject2Condition<Boolean>

descMatches

UiObject2Condition<Boolean> descMatches (String regex)

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

Parameters
regex String

Returns
UiObject2Condition<Boolean>

descMatches

UiObject2Condition<Boolean> descMatches (Pattern regex)

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

Parameters
regex Pattern

Returns
UiObject2Condition<Boolean>

descStartsWith

UiObject2Condition<Boolean> descStartsWith (String substring)

Returns a condition that is satisfied when the object's content description starts with the given string.

Parameters
substring String

Returns
UiObject2Condition<Boolean>

enabled

UiObject2Condition<Boolean> enabled (boolean isEnabled)

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

Parameters
isEnabled boolean: Whether the object should be enabled to satisfy this condition.

Returns
UiObject2Condition<Boolean>

findObject

SearchCondition<UiObject2> findObject (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.

Parameters
selector BySelector

Returns
SearchCondition<UiObject2>

findObjects

SearchCondition<List<UiObject2>> findObjects (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.

Parameters
selector BySelector

Returns
SearchCondition<List<UiObject2>>

focusable

UiObject2Condition<Boolean> focusable (boolean isFocusable)

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

Parameters
isFocusable boolean: Whether the object should be focusable to satisfy this condition.

Returns
UiObject2Condition<Boolean>

focused

UiObject2Condition<Boolean> focused (boolean isFocused)

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

Parameters
isFocused boolean: Whether the object should be focused to satisfy this condition.

Returns
UiObject2Condition<Boolean>

gone

SearchCondition<Boolean> gone (BySelector selector)

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

Parameters
selector BySelector

Returns
SearchCondition<Boolean>

hasObject

SearchCondition<Boolean> hasObject (BySelector selector)

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

Parameters
selector BySelector

Returns
SearchCondition<Boolean>

longClickable

UiObject2Condition<Boolean> longClickable (boolean isLongClickable)

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

Parameters
isLongClickable boolean: Whether the object should be long clickable to satisfy this condition.

Returns
UiObject2Condition<Boolean>

newWindow

EventCondition<Boolean> newWindow ()

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

Returns
EventCondition<Boolean>

scrollFinished

EventCondition<Boolean> scrollFinished (Direction direction)

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

Parameters
direction Direction: The direction of the scroll.

Returns
EventCondition<Boolean>

scrollable

UiObject2Condition<Boolean> scrollable (boolean isScrollable)

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

Parameters
isScrollable boolean: Whether the object should be scrollable to satisfy this condition.

Returns
UiObject2Condition<Boolean>

selected

UiObject2Condition<Boolean> selected (boolean isSelected)

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

Parameters
isSelected boolean: Whether the object should be selected to satisfy this condition.

Returns
UiObject2Condition<Boolean>

textContains

UiObject2Condition<Boolean> textContains (String substring)

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

Parameters
substring String

Returns
UiObject2Condition<Boolean>

textEndsWith

UiObject2Condition<Boolean> textEndsWith (String substring)

Returns a condition that is satisfied when the object's text value ends with the given string.

Parameters
substring String

Returns
UiObject2Condition<Boolean>

textEquals

UiObject2Condition<Boolean> textEquals (String text)

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

Parameters
text String

Returns
UiObject2Condition<Boolean>

textMatches

UiObject2Condition<Boolean> textMatches (String regex)

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

Parameters
regex String

Returns
UiObject2Condition<Boolean>

textMatches

UiObject2Condition<Boolean> textMatches (Pattern regex)

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

Parameters
regex Pattern

Returns
UiObject2Condition<Boolean>

textNotEquals

UiObject2Condition<Boolean> textNotEquals (String text)

Parameters
text String

Returns
UiObject2Condition<Boolean>

textStartsWith

UiObject2Condition<Boolean> textStartsWith (String substring)

Returns a condition that is satisfied when the object's text value starts with the given string.

Parameters
substring String

Returns
UiObject2Condition<Boolean>