Use correct resource id for verifying launching Lens from PSB
Fix: 292083393 Test: Qsb#launchLens Flag: NA Change-Id: Id248e1f6a166a02e29eaa8a8f23d55fbdd462672
This commit is contained in:
@@ -22,6 +22,8 @@ import androidx.test.uiautomator.BySelector;
|
||||
import androidx.test.uiautomator.UiObject2;
|
||||
import androidx.test.uiautomator.Until;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* Operations on qsb from either Home screen or AllApp screen.
|
||||
*/
|
||||
@@ -30,7 +32,8 @@ public abstract class Qsb implements SearchInputSource {
|
||||
private static final String ASSISTANT_APP_PACKAGE = "com.google.android.googlequicksearchbox";
|
||||
private static final String ASSISTANT_ICON_RES_ID = "mic_icon";
|
||||
private static final String LENS_ICON_RES_ID = "lens_icon";
|
||||
private static final String LENS_APP_TEXT_RES_ID = "lens_camera_cutout_text";
|
||||
private static final Pattern LENS_APP_RES_PATTERN = Pattern.compile(
|
||||
ASSISTANT_APP_PACKAGE + ":id/lens.*");
|
||||
protected final LauncherInstrumentation mLauncher;
|
||||
private final UiObject2 mContainer;
|
||||
private final String mQsbResName;
|
||||
@@ -96,8 +99,8 @@ public abstract class Qsb implements SearchInputSource {
|
||||
try (LauncherInstrumentation.Closable c2 = mLauncher.addContextLayer("clicked")) {
|
||||
// Package name is not enough to check if the app is launched, because many
|
||||
// elements are having googlequicksearchbox as package name. So it checks if the
|
||||
// corresponding text resource is displayed
|
||||
BySelector selector = By.res(ASSISTANT_APP_PACKAGE, LENS_APP_TEXT_RES_ID);
|
||||
// corresponding app resource is displayed
|
||||
BySelector selector = By.res(LENS_APP_RES_PATTERN);
|
||||
mLauncher.assertTrue(
|
||||
"Lens app didn't start: (" + selector + ")",
|
||||
mLauncher.getDevice().wait(Until.hasObject(selector),
|
||||
|
||||
Reference in New Issue
Block a user