UiAutomatorTestScopeKt

Added in 2.4.0-alpha02

public final class UiAutomatorTestScopeKt


Summary

Public methods

static final void

Main entry point for ui automator tests.

Public methods

public static final void uiAutomator(
    @ExtensionFunctionType @NonNull Function1<@NonNull UiAutomatorTestScopeUnit> block
)

Main entry point for ui automator tests. It creates a UiAutomatorTestScope in which a test can be defined.

Example:

@Test
fun
myTest() = uiAutomator {

startActivity(MyActivity::class.java)

onView { id == "button" }.click()

onView { id == "nested_elements" }
.apply {
onView { text == "First Level" }
onView { text == "Second Level" }
onView { text == "Third Level" }
}
}
Parameters
@ExtensionFunctionType @NonNull Function1<@NonNull UiAutomatorTestScopeUnit> block

A block containing the test to run within the UiAutomatorTestScope.