diff options
Diffstat (limited to 'tests/PhotoPicker/src/android/photopicker/cts/ActionGetContentOnlyTest.java')
-rw-r--r-- | tests/PhotoPicker/src/android/photopicker/cts/ActionGetContentOnlyTest.java | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/tests/PhotoPicker/src/android/photopicker/cts/ActionGetContentOnlyTest.java b/tests/PhotoPicker/src/android/photopicker/cts/ActionGetContentOnlyTest.java index 93a16ee55c7..25e8ebdfb40 100644 --- a/tests/PhotoPicker/src/android/photopicker/cts/ActionGetContentOnlyTest.java +++ b/tests/PhotoPicker/src/android/photopicker/cts/ActionGetContentOnlyTest.java @@ -178,7 +178,7 @@ public class ActionGetContentOnlyTest extends PhotoPickerBaseTest { mActivity.startActivityForResult(Intent.createChooser(intent, TAG), REQUEST_CODE); // Should open Picker - UiAssertionUtils.assertThatShowsPickerUi(); + UiAssertionUtils.assertThatShowsPickerUi(intent.getType()); } @Test @@ -200,7 +200,7 @@ public class ActionGetContentOnlyTest extends PhotoPickerBaseTest { findAndClickMediaIcon(); // Should open Picker - UiAssertionUtils.assertThatShowsPickerUi(); + UiAssertionUtils.assertThatShowsPickerUi(intent.getType()); } private void findAndClickMediaIcon() throws Exception { @@ -211,10 +211,19 @@ public class ActionGetContentOnlyTest extends PhotoPickerBaseTest { assertWithMessage("Waiting for app list to appear in DocumentsUi").that( new UiObject(appList).waitForExists(SHORT_TIMEOUT)).isTrue(); - String photoPickerAppName = "Media picker"; + String photoPickerAppName = "Media"; UiObject mediaButton = sDevice.findObject(new UiSelector().text(photoPickerAppName)); - - assertWithMessage("Timed out waiting for " + photoPickerAppName + " app icon to appear") + if (!new UiScrollable(appList).setAsHorizontalList().scrollIntoView(mediaButton)) { + // While solving an accessibility bug the app_label was modified from 'Media' to + // 'Media picker' and after making the modification, since this test had the + // hardcoded value for the name as 'Media' it started failing. After fixing this some + // versions of the code became incompatible with this test and hence have modified + // the code to work with both names. + photoPickerAppName = "Media picker"; + mediaButton = sDevice.findObject(new UiSelector().text(photoPickerAppName)); + } + assertWithMessage("Timed out waiting for " + photoPickerAppName + + " app icon to appear") .that(new UiScrollable(appList).setAsHorizontalList().scrollIntoView(mediaButton)) .isTrue(); sDevice.waitForIdle(); |