From d30433c92e3d5f34e8965f08b544d487fb6a14cc Mon Sep 17 00:00:00 2001 From: Vilas Bhat Date: Fri, 17 Jan 2025 23:01:05 +0000 Subject: [PATCH] 16KB: Fix failing tests for AOSP targets UiAutomator is case sensitive. On AOSP builds, the "Erase all data" string is displayed in all caps in the dialog box on trying to erase all data and switch to ext4 mode. This is a workaround fix for the issue. Bug: 390535191 Flag: EXEMPT bugfix Test: Enable16kbTest on AOSP Pixel 8 targets Change-Id: I119fe076eb3eb037a23f07af77b9ad4935cb4064 --- .../development/test/Enable16KbDeviceTest.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/Enable16KbTests/test_16kb_app/src/com/android/settings/development/test/Enable16KbDeviceTest.java b/tests/Enable16KbTests/test_16kb_app/src/com/android/settings/development/test/Enable16KbDeviceTest.java index 9e489cf4115..ecb31232db2 100644 --- a/tests/Enable16KbTests/test_16kb_app/src/com/android/settings/development/test/Enable16KbDeviceTest.java +++ b/tests/Enable16KbTests/test_16kb_app/src/com/android/settings/development/test/Enable16KbDeviceTest.java @@ -37,6 +37,8 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import java.util.Locale; + @RunWith(AndroidJUnit4.class) public class Enable16KbDeviceTest { private static final long TIMEOUT = 2000; @@ -92,7 +94,15 @@ public class Enable16KbDeviceTest { // Verify that ext4 toggle is visible verifyTextOnScreen(EXT4_TITLE); - mDevice.wait(Until.findObject(By.text(EXT4_CONFIRMATION)), TIMEOUT).click(); + UiObject2 confirmationObject = + mDevice.wait(Until.findObject(By.text(EXT4_CONFIRMATION)), TIMEOUT); + if (confirmationObject == null) { + // Workaround for (b/390535191). AOSP targets display the string in all caps. + confirmationObject = mDevice.wait( + Until.findObject(By.text(EXT4_CONFIRMATION.toUpperCase(Locale.ROOT))), TIMEOUT); + } + assertTrue(confirmationObject != null); + confirmationObject.click(); } @Test