Configurator


class Configurator


Allows you to set key parameters for running UiAutomator tests. The new settings take effect immediately and can be changed at any time during a test run.

To modify parameters, first obtain an instance by calling getInstance. As a best practice, make sure you always save the original value of any parameter that you are modifying. After running your tests with the modified parameters, make sure to also restore the original parameter values, otherwise this will impact other tests cases.

Summary

Public functions

Long

Gets the current timeout for waiting for an acknowledgment of a UiObject click.

java-static Configurator

Retrieves a singleton instance of Configurator.

Long

This function is deprecated.

This parameter is no longer used (text is set directly rather than by key).

Long

Gets the current timeout for waiting for an acknowledgement of a UiScrollable scroll action.

Int

Gets the current tool type to use for motion events.

Int

Gets the current flags that are used to obtain a android.app.UiAutomation instance.

Long

Gets the current timeout used for waiting for the user interface to go into an idle state before starting a UiAutomator action.

Long

Gets the current timeout for waiting for a UiObject to become visible in the user interface so that it can be matched by a UiSelector.

Configurator

Sets the timeout for waiting for an acknowledgment of a UiObject click.

Configurator

This function is deprecated.

This parameter is no longer used (text is set directly rather than by key).

Configurator

Sets the timeout for waiting for an acknowledgement of a UiScrollable scroll action.

Configurator
setToolType(toolType: Int)

Sets the tool type to use for motion events.

Configurator

Sets the flags to use when obtaining a android.app.UiAutomation instance.

Configurator

Sets the timeout for waiting for the user interface to go into an idle state before starting a UiAutomator action.

Configurator

Sets the timeout for waiting for a UiObject to become visible in the user interface so that it can be matched by a UiSelector.

Public functions

getActionAcknowledgmentTimeout

Added in 2.2.0
fun getActionAcknowledgmentTimeout(): Long

Gets the current timeout for waiting for an acknowledgment of a UiObject click.

Returns
Long

current timeout in milliseconds

getInstance

Added in 2.2.0
java-static fun getInstance(): Configurator

Retrieves a singleton instance of Configurator.

Returns
Configurator

Configurator instance

getKeyInjectionDelay

Added in 2.2.0
Deprecated in 2.4.0-alpha01
fun getKeyInjectionDelay(): Long

Gets the current delay between key presses when injecting text input.

Returns
Long

current delay in milliseconds

getScrollAcknowledgmentTimeout

Added in 2.2.0
fun getScrollAcknowledgmentTimeout(): Long

Gets the current timeout for waiting for an acknowledgement of a UiScrollable scroll action.

Returns
Long

current timeout in milliseconds

getToolType

Added in 2.2.0
fun getToolType(): Int

Gets the current tool type to use for motion events.

Returns
Int

current tool type

See also
getToolType

getUiAutomationFlags

Added in 2.2.0
fun getUiAutomationFlags(): Int

Gets the current flags that are used to obtain a android.app.UiAutomation instance.

Returns
Int

UiAutomation flags

getWaitForIdleTimeout

Added in 2.2.0
fun getWaitForIdleTimeout(): Long

Gets the current timeout used for waiting for the user interface to go into an idle state before starting a UiAutomator action.

Returns
Long

current timeout in milliseconds

getWaitForSelectorTimeout

Added in 2.2.0
fun getWaitForSelectorTimeout(): Long

Gets the current timeout for waiting for a UiObject to become visible in the user interface so that it can be matched by a UiSelector.

Returns
Long

current timeout in milliseconds

setActionAcknowledgmentTimeout

Added in 2.2.0
fun setActionAcknowledgmentTimeout(timeout: Long): Configurator

Sets the timeout for waiting for an acknowledgment of a UiObject click.

The acknowledgment is an android.view.accessibility.AccessibilityEvent corresponding to a content change that lets the framework determine if the action was successful. Generally, this timeout should not be modified.

Has no effect on UiDevice and UiObject2 clicks.

Parameters
timeout: Long

Timeout value in milliseconds

Returns
Configurator

self

setKeyInjectionDelay

Added in 2.2.0
Deprecated in 2.4.0-alpha01
fun setKeyInjectionDelay(delay: Long): Configurator

Sets a delay between key presses when injecting text input.

Parameters
delay: Long

Delay value in milliseconds

Returns
Configurator

self

setScrollAcknowledgmentTimeout

Added in 2.2.0
fun setScrollAcknowledgmentTimeout(timeout: Long): Configurator

Sets the timeout for waiting for an acknowledgement of a UiScrollable scroll action.

The acknowledgment is an android.view.accessibility.AccessibilityEvent corresponding to the scroll action that lets the framework determine if it was successful. Generally, this timeout should not be modified.

Has no effect on UiObject2 scrolls.

Parameters
timeout: Long

Timeout value in milliseconds

Returns
Configurator

self

setToolType

Added in 2.2.0
fun setToolType(toolType: Int): Configurator

Sets the tool type to use for motion events.

Parameters
toolType: Int

The tool type to use

Returns
Configurator

self

setUiAutomationFlags

Added in 2.2.0
fun setUiAutomationFlags(flags: Int): Configurator

Sets the flags to use when obtaining a android.app.UiAutomation instance.

Parameters
flags: Int

The UiAutomation flags to use

Returns
Configurator

self

setWaitForIdleTimeout

Added in 2.2.0
fun setWaitForIdleTimeout(timeout: Long): Configurator

Sets the timeout for waiting for the user interface to go into an idle state before starting a UiAutomator action.

Parameters
timeout: Long

Timeout value in milliseconds

Returns
Configurator

self

setWaitForSelectorTimeout

Added in 2.2.0
fun setWaitForSelectorTimeout(timeout: Long): Configurator

Sets the timeout for waiting for a UiObject to become visible in the user interface so that it can be matched by a UiSelector.

For UiObjects, the underlying node is fetched with this timeout before every action.

Has no effect on UiObject2s, which cache the underlying node. Instead, use wait and findObject to wait for the object to become visible.

Parameters
timeout: Long

Timeout value in milliseconds

Returns
Configurator

self