waitForView

fun waitForView(matcher: Matcher<View>, timeout: Duration = DefaultDeviceTimeout, displayed: Boolean = true): ViewAction(source)

Returns an action, performed on the root view, that waits until a view matching matcher is displayed (displayed true) or until none is (displayed false).

The main thread keeps running between checks, so the app makes progress while the test waits.

Return

The action; perform it with onView(isRoot()).perform(action).

Parameters

matcher

Selects the view.

timeout

The nonnegative wait budget.

displayed

Whether to wait for the view to be displayed or to be gone.

Throws