summaryrefslogtreecommitdiff
path: root/libraries/launcher-helper/src/android/support/test/launcherhelper/AutoLauncherStrategy.java
diff options
context:
space:
mode:
authorJun <jjunwangg@google.com>2020-02-19 16:44:22 -0800
committerJun Wang <jjunwangg@google.com>2020-07-16 00:23:30 +0000
commit730218ec1f211e49c3a126034af1ee3e99c6bdf2 (patch)
tree1f32ea155f2605bdc293f714c6c14c104b18ebd9 /libraries/launcher-helper/src/android/support/test/launcherhelper/AutoLauncherStrategy.java
parent5a1dbd4b6e8a816e4f26e47ad596f7f60647a18b (diff)
downloadplatform_testing-730218ec1f211e49c3a126034af1ee3e99c6bdf2.tar.gz
change appSwitch ID
app switch ID in media facet is changed. Test: run MediaHelperTest bug: 161402778 Change-Id: Idc31b9f2e8b25ccc91338c0dde3f1ecab0042273 (cherry picked from commit cc3bca7d738d1a294100cc3cc6b310c7a25d982d) (cherry picked from commit eac5dfcb20b5c9d17888d7bec50b93e40eff83a4)
Diffstat (limited to 'libraries/launcher-helper/src/android/support/test/launcherhelper/AutoLauncherStrategy.java')
-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 4019a5968..bd0252157 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 = 10000;
@@ -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.");
}