class EspressoRemote : RemoteInteraction


A singleton class that facilitates communication between other Espresso instance that may be running in different processes.

This class depends on InstrumentationConnection to notify about the discovery of other remote Espresso instances and provide their Messenger object to use for further IPC.

To get the instance of this object getInstance should be called. The user of this class should then call init prior to attempting to use any functionality of this class. Call terminate after using EspressoRemote to release any resources. Failure to do so will lead to memory leaks and unexpected behavior.

Summary

Public functions

synchronized Callable<Void!>!
createRemoteCheckCallable(
    rootMatcher: Matcher<Root!>!,
    viewMatcher: Matcher<View!>!,
    iBinders: (Mutable)Map<String!, IBinder!>!,
    viewAssertion: ViewAssertion!
)

Creates a callable to run Espresso check interaction on remote processes

synchronized Callable<Void!>!
createRemotePerformCallable(
    rootMatcher: Matcher<Root!>!,
    viewMatcher: Matcher<View!>!,
    iBinders: (Mutable)Map<String!, IBinder!>!,
    viewActions: Array<ViewAction!>!
)

Creates a callable to run a perform interaction on remote processes.

java-static EspressoRemote!

Returns an instance of EspressoRemote object.

synchronized Unit

Must be called prior to using any functionality of this class.

Boolean

Returns {code true} if the current Espresso instance is communicating with another Espresso instance in a remote process.

synchronized Unit

Must be called to disable further use of this class.

Public properties

volatile java-static Boolean

Represents whether the current instance is running in a remote process or not

Inherited Constants

From androidx.test.espresso.remote.RemoteInteraction
const String!
BUNDLE_EXECUTION_STATUS = "executionStatus"

Public functions

createRemoteCheckCallable

synchronized fun createRemoteCheckCallable(
    rootMatcher: Matcher<Root!>!,
    viewMatcher: Matcher<View!>!,
    iBinders: (Mutable)Map<String!, IBinder!>!,
    viewAssertion: ViewAssertion!
): Callable<Void!>!

Creates a callable to run Espresso check interaction on remote processes

Parameters
rootMatcher: Matcher<Root!>!

the root matcher to use.

viewMatcher: Matcher<View!>!

the view matcher to use.

iBinders: (Mutable)Map<String!, IBinder!>!

a list of binders to pass along to the remote process instance

viewAssertion: ViewAssertion!

the view assertion to use.

Returns
Callable<Void!>!

the Callable

createRemotePerformCallable

synchronized fun createRemotePerformCallable(
    rootMatcher: Matcher<Root!>!,
    viewMatcher: Matcher<View!>!,
    iBinders: (Mutable)Map<String!, IBinder!>!,
    viewActions: Array<ViewAction!>!
): Callable<Void!>!

Creates a callable to run a perform interaction on remote processes.

If there no remote Espresso currently running in a timely manner the interaction will not be executed and a NoRemoteEspressoInstanceException will be thrown.

Parameters
rootMatcher: Matcher<Root!>!

the root matcher to use.

viewMatcher: Matcher<View!>!

the view matcher to use.

iBinders: (Mutable)Map<String!, IBinder!>!

a list of binders to pass along to the remote process instance

viewActions: Array<ViewAction!>!

one or more actions to execute.

Returns
Callable<Void!>!

a Callable that performs the action.

getInstance

java-static fun getInstance(): EspressoRemote!

Returns an instance of EspressoRemote object.

init

synchronized fun init(): Unit

Must be called prior to using any functionality of this class.

During initialization the instance of this class will be registered with .

isRemoteClient

fun isRemoteClient(): Boolean

Returns {code true} if the current Espresso instance is communicating with another Espresso instance in a remote process.

terminate

synchronized fun terminate(): Unit

Must be called to disable further use of this class.

During termination the instance of this class will be un-registered with and clear the list of known remote Espresso Messengers.

Public properties

isRemoteProcess

volatile java-static val isRemoteProcessBoolean

Represents whether the current instance is running in a remote process or not