Skip to content

Latest commit

 

History

History
55 lines (39 loc) · 1.11 KB

android-jetpack-compose.md

File metadata and controls

55 lines (39 loc) · 1.11 KB

Android - Jetpack Compose

Maestro supports Jetpack Compose.

Interacting with composable with Text

Given a composable with a displayed text:

Text(
    text = "Like",
    modifier = Modifier.fillMaxWidth(),
    textAlign = TextAlign.Center,
    style = MaterialTheme.typography.titleMedium,
    fontWeight = FontWeight.Bold
)

You can use the following command to tap on this Text :

- tapOn: "Like"

Interacting with composable with Accessibility

Given a composable without text, you can use semantics:

For the following composable:

FloatingActionButton(onClick = onClick, 
    modifier = Modifier
        .semantics { testTagsAsResourceId = true }.testTag("Add")
) {
    Icon(Icons.Filled.Add, "")
}

You can tap on this using testTag:

- tapOn: 
    id: "Add"

{% content-ref url="broken-reference" %} Broken link {% endcontent-ref %}

Resources