Skip to content

seriousQA/ExposedDropDownMenu_AQA_example

Repository files navigation

ExposedDropdownMenu_AQA_example

Example of ExposedDropdownMenu (material3:1.4.0-alpha13) for test automation

Kotlin Android Studio Apache-2-0 Compose Android

ExposedDropdownMenu is a menu display a list of choices on a temporary surface. It appears when users interact with a button, action, or other control.. dev_android_ExposedDropDownMenu

To interact using uiautomator2 you need:

  1. In build.gradle (:app) add the UIAutomator dependency: androidTestImplementation('androidx.test.uiautomator:uiautomator:$yourUiautomator2DriverVersion')
  2. add reference on androidx.compose.ui.semantics: import androidx.compose.ui.semantics.semantics import androidx.compose.ui.semantics.testTagsAsResourceId
  3. locate the root composable function in your UI and enable test tags by setting testTagsAsResourceId to true in the modifier
  4. add a test tag for each composable function you need to interact with during the tests

testTagAsResourceId ExposedDropDownMenuItems

You can also use a contentDescription in the modifier to interact with UI elements during the tests.

The advantage of the testTags is that you can get the value of the element's ‘text’ attribute:

image

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages