Is there any way to convert current automation testing which code with Android XML that migrated to Jetpack Compose?

Hi, I already create a test case for a feature which developed by Android XML which reach id using resource-id, it works. Now the feature is migrated into Jetpack Compose view that cannot provide that id. I there any way to solved it? Thank you

From what I have seen the only way to automate apps that use jetpack compose in a stable way is to use the updated appium espresso driver that has been added to appium 2.0. I haven’t gotten it working within the remote execution of Katalon Studio but it should work.

Alternatively because jetpack compose does not create he xml views I have been able to hack through creating tests that use xpath locators and sibling objects. From what I have seen when appium attempts to create the xml tree it creates multiple selectable objects for the same object but the identifier will be in one object and the intractable object will be a separate sibling object.

2 Likes

Hi Kreno,

Thank you for the response. When I deep down the feature of jetpack compose, it has semantic method that has attribute content-description, I use this attribute to select existing view that using resource-id and convert it into content-description so the changes is not big at all. But if there any have other best practice, I would love it. Thanks

@suyanwar yes if you are okay using content-descriptions for automated tests then this will work. If your content descriptions are localized and you will run them in multiple languages then this might not work. I did find out that google added a way set the resource-id for the objects as the testTags inside jetpack compose and is likely how we will be automating our app.

https://developer.android.com/jetpack/compose/testing#uiautomator-interop