summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJun Wang <jjunwangg@google.com>2020-07-17 23:02:13 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-07-17 23:02:13 +0000
commit3fde63a61c78f53f7fbd8a16de80ed1d1342d344 (patch)
tree477d3923ced24dec4bc18da66ad2cdc71bf73656
parent20ad7241e157d2ae7797c924487276061d8aeea6 (diff)
parent730218ec1f211e49c3a126034af1ee3e99c6bdf2 (diff)
downloadplatform_testing-3fde63a61c78f53f7fbd8a16de80ed1d1342d344.tar.gz
Merge "change appSwitch ID" into rvc-devandroid11-dev
-rw-r--r--libraries/launcher-helper/src/android/support/test/launcherhelper/AutoLauncherStrategy.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/libraries/launcher-helper/src/android/support/test/launcherhelper/AutoLauncherStrategy.java b/libraries/launcher-helper/src/android/support/test/launcherhelper/AutoLauncherStrategy.java
index 3a97a4b8d..cdcd388dc 100644
--- a/libraries/launcher-helper/src/android/support/test/launcherhelper/AutoLauncherStrategy.java
+++ b/libraries/launcher-helper/src/android/support/test/launcherhelper/AutoLauncherStrategy.java
@@ -42,7 +42,7 @@ public class AutoLauncherStrategy implements IAutoLauncherStrategy {
private static final String DIAL_PACKAGE = "com.android.car.dialer";
private static final String ASSISTANT_PACKAGE = "com.google.android.googlequicksearchbox";
private static final String SETTINGS_PACKAGE = "com.android.car.settings";
- private static final String APP_SWITCH_ID = "app_switch_container";
+ private static final String APP_SWITCH_ID = "car_ui_toolbar_menu_item_icon_container";
private static final String APP_LIST_ID = "apps_grid";
private static final long APP_LAUNCH_TIMEOUT = 30000;
@@ -157,7 +157,15 @@ public class AutoLauncherStrategy implements IAutoLauncherStrategy {
openMediaFacet();
// Click on app switch to open app list.
- UiObject2 appSwitch = mDevice.wait(Until.findObject(APP_SWITCH), APP_LAUNCH_TIMEOUT);
+ List<UiObject2> buttons = mDevice.wait(
+ Until.findObjects(APP_SWITCH), APP_LAUNCH_TIMEOUT);
+ int lastIndex = buttons.size() - 1;
+ /*
+ * On some media app page, there are two buttons with the same ID,
+ * while on other media app page, only the app switch button presents.
+ * The app switch button is always the last button if not the only button.
+ */
+ UiObject2 appSwitch = buttons.get(lastIndex);
if (appSwitch == null) {
throw new RuntimeException("Failed to find app switch.");
}