From bfb7c269b04ec6044e79d198cf485487e083aa6b Mon Sep 17 00:00:00 2001 From: Andy Wickham Date: Fri, 12 Jan 2024 23:35:44 +0000 Subject: [PATCH] Ensure "AppIconSelector" does not match folders. Not sure if this is considered brittle, but at this moment, the BubbleTextView used for folder labels is not focusable, while the one used for app labels is focusable. Also add package name to the context logs to help debug similar test failures in the future. Fix: 319194153 Test: atest android.platform.test.scenario.google.OpenAppMicrobenchmark$1#testOpen Flag: NA Change-Id: Ibf88afdd6d3ef03b75ea44910b485e7e74e348b0 --- tests/tapl/com/android/launcher3/tapl/AppIcon.java | 3 ++- tests/tapl/com/android/launcher3/tapl/Launchable.java | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/tapl/com/android/launcher3/tapl/AppIcon.java b/tests/tapl/com/android/launcher3/tapl/AppIcon.java index 867a1a8c05..156568b0f4 100644 --- a/tests/tapl/com/android/launcher3/tapl/AppIcon.java +++ b/tests/tapl/com/android/launcher3/tapl/AppIcon.java @@ -42,7 +42,8 @@ public abstract class AppIcon extends Launchable { * @param appName app icon to look for */ static BySelector getAppIconSelector(String appName) { - return By.clazz(TextView.class).text(makeMultilinePattern(appName)); + // focusable=true to avoid matching folder labels + return By.clazz(TextView.class).text(makeMultilinePattern(appName)).focusable(true); } /** diff --git a/tests/tapl/com/android/launcher3/tapl/Launchable.java b/tests/tapl/com/android/launcher3/tapl/Launchable.java index 28e2590c12..ed47334577 100644 --- a/tests/tapl/com/android/launcher3/tapl/Launchable.java +++ b/tests/tapl/com/android/launcher3/tapl/Launchable.java @@ -56,8 +56,8 @@ public abstract class Launchable { */ public LaunchedAppState launch(String expectedPackageName) { try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck()) { - try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer( - "want to launch an app from " + launchableType())) { + try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer(String.format( + "want to launch an app (%s) from %s", expectedPackageName, launchableType()))) { LauncherInstrumentation.log("Launchable.launch before click " + mObject.getVisibleCenter() + " in " + mLauncher.getVisibleBounds(mObject));