Appium automation project using kotlin, gradle, cucumber.
This sample code demonstrates the appium automation of Android Jetpack compose views.
A simple app written in Jetpack compose with just a login screen
Appium gradle project written in kotlin using cucmber.
Appium Espresso driver is required to get the compose views. Because of some incompatibility in the Appium espresso driver app, a workaround is necessary in the capabilities.
Tested with appium version 1.23.0-beta.0
Compose views need to add a special testTag
Modifier for Appium driver to detect the compose nodes.
Text(
modifier = Modifier
.padding(4.dp)
.testTag("title"),
text = "App Login",
fontSize = 24.sp
)
With this Appium compose driver can detect the compose node
@AndroidFindBy(tagName = "title")
lateinit var title: WebElement
In order to make the Espresso driver to detect compose view elements, the driver settings need to be updated(https://github.com/appium/appium-espresso-driver/blob/master/README.md#settings-api)
appiumDriver.setSetting("driver", "compose")
Appium inspector can't detect the compose view elements by default.
This is how Appium inspector shows the compose views
In order to change the driver to compose mode, update the settings in Actions. In Actions tab, select 'Session', 'Settings' and 'Update settings' button.
{
"driver": "compose"
}
This will update the driver mode to compose and the compose nodes will show up on refresh.