Package com.tomtom.ivi.platform.tools.api.testing.functional.util

Properties

Link copied to clipboard
const val DEFAULT_WAIT_LIVE_DATA_TIMEOUT_MS: Long = 10000

Starting the Android service process can be very slow on the CI.

Link copied to clipboard
val View.locationOnScreen: Point

Returns a Point containing the coordinates of the View's origin in relation to the screen.

Functions

Link copied to clipboard
suspend fun <T> LiveData<T>.coWaitForLiveData(timeoutMs: Long = DEFAULT_WAIT_LIVE_DATA_TIMEOUT_MS, predicate: (T) -> Boolean): Boolean

Wait for the LiveData instance to have a given predicate from a coroutine context on the main thread.

Link copied to clipboard
fun <T> LiveData<T>.getOrAwaitValue(timeoutMs: Long = DEFAULT_WAIT_LIVE_DATA_TIMEOUT_MS): T

Waits utils this LiveData value is set.

Link copied to clipboard
fun UiDevice.waitFor(selector: BySelector, timeoutMs: Long = DEFAULT_WAIT_FOR_TIMEOUT_MS): UiObject2

Helper method to wait for a given selector to be found.

Link copied to clipboard
fun <R> waitForAndCheckIviServiceAsyncFunResult(    timeoutMs: Long = DEFAULT_WAIT_LIVE_DATA_TIMEOUT_MS,     expectedResultType: IviServiceFunResult.ResultType = IviServiceFunResult.ResultType.SUCCESSFUL,     function: ((IviServiceFunResult<R?>?) -> Unit) -> Unit): IviServiceFunResult<R?>

Utility function to wait for an IVI service async function result and check the result.

Link copied to clipboard
fun <R, F : KFunction<R>> waitForAndCheckIviServiceCoFunResult(    function: F,     timeoutMs: Long = DEFAULT_WAIT_LIVE_DATA_TIMEOUT_MS,     block: suspend (F) -> R): R

Utility function to wait for an IVI service coroutine function result and check it.

Link copied to clipboard
fun <R> waitForIviServiceAsyncFunResult(timeoutMs: Long = DEFAULT_WAIT_LIVE_DATA_TIMEOUT_MS, function: ((IviServiceFunResult<R?>?) -> Unit) -> Unit): IviServiceFunResult<R?>

Utility function to wait for an IVI service async function result.

Link copied to clipboard
fun <R, F : KFunction<R>> waitForIviServiceCoFunResult(    function: F,     timeoutMs: Long,     block: suspend (F) -> R): R

Utility function to wait for an IVI service coroutine function result.

Link copied to clipboard
fun <T> LiveData<T>.waitForLiveData(timeoutMs: Long = DEFAULT_WAIT_LIVE_DATA_TIMEOUT_MS, predicate: (T) -> Boolean): Boolean

Wait for the LiveData instance to have a given predicate.

Link copied to clipboard
fun waitForNonUi(    timeoutMs: Long,     intervalMs: Long = DEFAULT_INTERVAL_MS,     predicate: () -> Boolean): Boolean

Utility function to wait for a predicate to return true. The predicate is invoked periodically with intervalMs as interval until the timeoutMs timeout is reached.