AtomAction


class AtomAction<E> : ViewAction, Bindable


A ViewAction which causes the provided Atom to be evaluated within a webview.

It is not recommended to use AtomAction directly.

Instead {@see androidx.test.espresso.web.sugar.Web} for examples of how to interact with a WebView's content through Atoms.

If you must use AtomAction directly, take care to remember that they are Stateful (unlike most ViewActions) and the caller must call get to ensure that the action has completed.

Parameters
<E>

The type the specific Atom returns.

Summary

Public constructors

AtomAction(
    atom: Atom<E!>!,
    window: WindowReference?,
    element: ElementReference?
)

Creates an AtomAction.

Public functions

E!
get()

Blocks until the atom has completed execution.

E!
get(val: Long, unit: TimeUnit!)

Blocks until the atom has completed execution with a configurable timeout.

Matcher<View!>!

A mechanism for ViewActions to specify what type of views they can operate on.

String!

Returns a description of the view action.

Future<E!>!

Return a Future, which will be set and transformed from futureEval.

IBinder!
String!
Unit
perform(uiController: UiController!, view: View!)

Performs this action on the given view.

Unit
setIBinder(binder: IBinder!)

Sets the IBinder of the implementing class.

Public constructors

AtomAction

AtomAction(
    atom: Atom<E!>!,
    window: WindowReference?,
    element: ElementReference?
)

Creates an AtomAction.

Parameters
atom: Atom<E!>!

the atom to execute

window: WindowReference?

(optional/nullable) the window context to execute on.

element: ElementReference?

(optional/nullable) the element to execute on.

Public functions

get

fun get(): E!

Blocks until the atom has completed execution.

Throws
java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException
java.lang.InterruptedException: java.lang.InterruptedException

get

fun get(val: Long, unit: TimeUnit!): E!

Blocks until the atom has completed execution with a configurable timeout.

Throws
java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException
java.lang.InterruptedException: java.lang.InterruptedException
java.util.concurrent.TimeoutException: java.util.concurrent.TimeoutException

getConstraints

fun getConstraints(): Matcher<View!>!

A mechanism for ViewActions to specify what type of views they can operate on.

A ViewAction can demand that the view passed to perform meets certain constraints. For example it may want to ensure the view is already in the viewable physical screen of the device or is of a certain type.

Returns
Matcher<View!>!

a Matcher that will be tested prior to calling perform.

getDescription

fun getDescription(): String!

Returns a description of the view action. The description should not be overly long and should fit nicely in a sentence like: "performing %description% action on view with id ..."

getFuture

fun getFuture(): Future<E!>!

Return a Future, which will be set and transformed from futureEval. Espresso's public API cannot have guava types in its method signatures, so return Future instead of ListenableFuture or SettableFuture.

getIBinder

fun getIBinder(): IBinder!
Returns
IBinder!

the IBinder of the implementing class.

getId

fun getId(): String!
Returns
String!

the id of the Bindable class.

perform

fun perform(uiController: UiController!, view: View!): Unit

Performs this action on the given view.

Parameters
uiController: UiController!

the controller to use to interact with the UI.

view: View!

the view to act upon. never null.

setIBinder

fun setIBinder(binder: IBinder!): Unit

Sets the IBinder of the implementing class.

Parameters
binder: IBinder!

the IBinder