From 21bdb605bfa06a2f1baaa66d6b8e443e7d4b3478 Mon Sep 17 00:00:00 2001 From: Ivan Chiang Date: Thu, 5 Jun 2025 05:47:50 +0000 Subject: [PATCH] Fix the test case fail with PIA V2 In PackageInstaller V2 (PIA V2), the string is updated. Update the test case. Flag: android.content.pm.use_pia_v2 Bug: 420539987 Test: atest com.android.launcher3.dragging.TaplUninstallRemoveTest#testUninstallFromWorkspace Change-Id: Icff1d7b44a34ebe940e66c57f9a6ea1a8477b8ec --- .../com/android/launcher3/tapl/Workspace.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tests/tapl/com/android/launcher3/tapl/Workspace.java b/tests/tapl/com/android/launcher3/tapl/Workspace.java index 68c7049a11..d1c4ccc235 100644 --- a/tests/tapl/com/android/launcher3/tapl/Workspace.java +++ b/tests/tapl/com/android/launcher3/tapl/Workspace.java @@ -465,16 +465,17 @@ public final class Workspace extends Home { launcher.waitUntilLauncherObjectGone(DROP_BAR_RES_ID); final BySelector installerAlert = By.text(Pattern.compile( - "Do you want to uninstall this app\\?", - Pattern.DOTALL | Pattern.MULTILINE)); + ".*uninstall this app\\?", + Pattern.DOTALL | Pattern.MULTILINE | Pattern.CASE_INSENSITIVE)); final UiDevice device = launcher.getDevice(); assertTrue("uninstall alert is not shown", device.wait( Until.hasObject(installerAlert), LauncherInstrumentation.WAIT_TIME_MS)); - final UiObject2 ok = device.findObject(By.text("OK")); - assertNotNull("OK button is not shown", ok); - launcher.clickObject(ok); - assertTrue("Uninstall alert is not dismissed after clicking OK", device.wait( - Until.gone(installerAlert), LauncherInstrumentation.WAIT_TIME_MS)); + final UiObject2 confirm = device.findObject(By.text(Pattern.compile( + "OK|Uninstall", Pattern.CASE_INSENSITIVE))); + assertNotNull("Confirm button is not shown", confirm); + launcher.clickObject(confirm); + assertTrue("Uninstall alert is not dismissed after clicking confirm button", + device.wait(Until.gone(installerAlert), LauncherInstrumentation.WAIT_TIME_MS)); try (LauncherInstrumentation.Closable c1 = launcher.addContextLayer( "uninstalled app by dragging to the drop bar")) {