From ae00f5194ef0df790fe9bcd5545e7562cb539efe Mon Sep 17 00:00:00 2001 From: Ajesh R Date: Tue, 29 Jul 2025 16:53:10 +0530 Subject: [PATCH] Replace UiAutomator onView with onElement The PromptBenchmark and BaselineProfileGenerator were updated to use `onElement` instead of the deprecated `onView` for UI interaction in tests. --- .../androidify/baselineprofile/BaselineProfileGenerator.kt | 6 +++--- .../developers/androidify/benchmark/PromptBenchmark.kt | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/benchmark/src/main/kotlin/com/android/developers/androidify/baselineprofile/BaselineProfileGenerator.kt b/benchmark/src/main/kotlin/com/android/developers/androidify/baselineprofile/BaselineProfileGenerator.kt index 6a548216..c6f58951 100644 --- a/benchmark/src/main/kotlin/com/android/developers/androidify/baselineprofile/BaselineProfileGenerator.kt +++ b/benchmark/src/main/kotlin/com/android/developers/androidify/baselineprofile/BaselineProfileGenerator.kt @@ -45,9 +45,9 @@ class BaselineProfileGenerator { ) { uiAutomator { startApp(packageName = packageName) - onView { textAsString() == "Let's Go" }.click() - onView { textAsString() == "Prompt" }.click() - onView { isEditable }.apply { + onElement { textAsString() == "Let's Go" }.click() + onElement{ textAsString() == "Prompt" }.click() + onElement{ isEditable }.apply { click() text = "wearing brown sneakers, a red t-shirt, " + diff --git a/benchmark/src/main/kotlin/com/android/developers/androidify/benchmark/PromptBenchmark.kt b/benchmark/src/main/kotlin/com/android/developers/androidify/benchmark/PromptBenchmark.kt index 7cace85a..cfe51917 100644 --- a/benchmark/src/main/kotlin/com/android/developers/androidify/benchmark/PromptBenchmark.kt +++ b/benchmark/src/main/kotlin/com/android/developers/androidify/benchmark/PromptBenchmark.kt @@ -68,9 +68,9 @@ class PromptBenchmark { ) { uiAutomator { startApp(packageName = packageName) - onView { textAsString() == "Let's Go" }.click() - onView { textAsString() == "Prompt" }.click() - onView { isEditable }.apply { + onElement { textAsString() == "Let's Go" }.click() + onElement { textAsString() == "Prompt" }.click() + onElement { isEditable }.apply { click() text = "wearing brown sneakers, a red t-shirt, " +