getOrAwaitValue

fun <T> LiveData<T>.getOrAwaitValue(timeoutMs: Long = DEFAULT_WAIT_LIVE_DATA_TIMEOUT_MS): T

Waits utils this LiveData value is set.

Returns the value if the value is set before the timeout is exceeded. Throws TimeoutCancellationException if the timeoutMs was exceeded.

Can be called from the test thread. Can not be called on the main thread.