summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRohith Venneti <rohith.venneti@gm.com>2023-03-23 19:34:02 -0400
committerKarthik Ramakrishnan <karthikmr@google.com>2023-03-24 20:59:07 +0000
commit4f4f4b70094d9ad5c0731f940791fb0c1f906e20 (patch)
treec8df6d43fd045a32611a29270c6bdc646834aad8
parent9309baa4f84b7180eca6dde7ffdeb540369d551f (diff)
downloadcts-4f4f4b70094d9ad5c0731f940791fb0c1f906e20.tar.gz
Fix AppHibernationIntegrationTest scrolling
Implementation of Settings App Info page has changed, the unused apps switch toggle is not found in the test. Use UiAutomatorUtils.waitFindObjectOrNull(By.text(title)) to fix this issue.Used the latest patch provided by Google Test: run cts -m CtsOsTestCases -t android.os.cts.AppHibernationIntegrationTest#testAppInfo_RemovePermissionsAndFreeUpSpaceToggleExists --abi arm64-v8a Bug: 270432491 Merged-In: I9e96fbb99578147b7edfd57614ca3e996ee6b7d4 Change-Id: If7ce0d25356b9a29a77f60f3f25e77f95435f041
-rw-r--r--tests/tests/os/src/android/os/cts/AppHibernationIntegrationTest.kt9
1 files changed, 4 insertions, 5 deletions
diff --git a/tests/tests/os/src/android/os/cts/AppHibernationIntegrationTest.kt b/tests/tests/os/src/android/os/cts/AppHibernationIntegrationTest.kt
index 7311878cf62..0b44f6ef670 100644
--- a/tests/tests/os/src/android/os/cts/AppHibernationIntegrationTest.kt
+++ b/tests/tests/os/src/android/os/cts/AppHibernationIntegrationTest.kt
@@ -176,7 +176,6 @@ class AppHibernationIntegrationTest {
context.startActivity(intent)
waitForIdle()
- UiAutomatorUtils.getUiDevice()
val packageManager = context.packageManager
val settingsPackage = intent.resolveActivity(packageManager).packageName
@@ -186,13 +185,13 @@ class AppHibernationIntegrationTest {
// Settings can have multiple scrollable containers so all of them should be
// searched.
- var toggleFound = UiDevice.getInstance(instrumentation)
- .findObject(UiSelector().text(title))
- .waitForExists(WAIT_TIME_MS)
+ var toggleFound = UiAutomatorUtils.waitFindObjectOrNull(By.text(title)) != null
var i = 0
var scrollableObject = UiScrollable(UiSelector().scrollable(true).instance(i))
while (!toggleFound && scrollableObject.waitForExists(WAIT_TIME_MS)) {
- toggleFound = scrollableObject.scrollTextIntoView(title)
+ // The following line should work for both handheld device and car settings.
+ toggleFound = scrollableObject.scrollTextIntoView(title) ||
+ UiAutomatorUtils.waitFindObjectOrNull(By.text(title)) != null
scrollableObject = UiScrollable(UiSelector().scrollable(true).instance(++i))
}