UiAutomatorTestScopeKt

Added in 2.4.0

public final class UiAutomatorTestScopeKt


Summary

Public methods

static final void

Main entry point for ui automator tests.

Public methods

public static final void uiAutomator(@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)

onElement { id == "button"

}.click() onElement { id == "nes
ted_elements&quo
t;
} .apply { onElement { tex
t
== "First Level" } onElem
ent
{ text == "Second Level" }
onEl
ement
{ text == "Third Level" } }}
Parameters
@NonNull Function1<@NonNull UiAutomatorTestScopeUnit> block

A block containing the test to run within the UiAutomatorTestScope.