diff --git a/wa/workloads/youtube/__init__.py b/wa/workloads/youtube/__init__.py index c021b85b..dbd44623 100755 --- a/wa/workloads/youtube/__init__.py +++ b/wa/workloads/youtube/__init__.py @@ -53,7 +53,7 @@ class Youtube(ApkUiautoWorkload): 5. Scroll down to the end of related videos and comments under the info card, and then back up to the start. A maximum of 5 swipe actions is performed in either direction. - Known working APK version: 12.21.57 + Known working APK version: 15.45.32 ''' package_names = ['com.google.android.youtube'] diff --git a/wa/workloads/youtube/com.arm.wa.uiauto.youtube.apk b/wa/workloads/youtube/com.arm.wa.uiauto.youtube.apk index 412a9184..313e5dde 100644 Binary files a/wa/workloads/youtube/com.arm.wa.uiauto.youtube.apk and b/wa/workloads/youtube/com.arm.wa.uiauto.youtube.apk differ diff --git a/wa/workloads/youtube/uiauto/app/src/main/java/com/arm/wa/uiauto/youtube/UiAutomation.java b/wa/workloads/youtube/uiauto/app/src/main/java/com/arm/wa/uiauto/youtube/UiAutomation.java index 8f39300c..13eb012c 100755 --- a/wa/workloads/youtube/uiauto/app/src/main/java/com/arm/wa/uiauto/youtube/UiAutomation.java +++ b/wa/workloads/youtube/uiauto/app/src/main/java/com/arm/wa/uiauto/youtube/UiAutomation.java @@ -122,7 +122,7 @@ public class UiAutomation extends BaseUiAutomation { } public void disableAutoplay() throws Exception { - UiObject moreoptions = + UiObject moreoptions = mDevice.findObject(new UiSelector().descriptionContains("More options")); if (moreoptions.exists()) { moreoptions.click(); @@ -151,6 +151,14 @@ public class UiAutomation extends BaseUiAutomation { } } + private void playFirstVideo() throws Exception { + UiObject resultsList = + mDevice.findObject(new UiSelector().resourceId(packageID + "results")); + UiObject firstVideo = + resultsList.getFromParent(new UiSelector().clickable(true)); + firstVideo.clickAndWaitForNewWindow(); + } + public void testPlayVideo(String source, String searchTerm) throws Exception { String testTag = "play"; ActionLogger logger = new ActionLogger(testTag + "_" + source, parameters); @@ -162,16 +170,13 @@ public class UiAutomation extends BaseUiAutomation { mDevice.pressEnter(); // If a video exists whose title contains the exact search term, then play it // Otherwise click the first video in the search results - UiObject thumbnail = - mDevice.findObject(new UiSelector().resourceId(packageID + "thumbnail")); - UiObject matchedVideo = - thumbnail.getFromParent(new UiSelector().textContains(searchTerm)); + UiObject matchedVideo = mDevice.findObject(new UiSelector().descriptionContains(searchTerm)); logger.start(); if (matchedVideo.exists()) { matchedVideo.clickAndWaitForNewWindow(); } else { - thumbnail.clickAndWaitForNewWindow(); + playFirstVideo(); } logger.stop(); @@ -180,14 +185,15 @@ public class UiAutomation extends BaseUiAutomation { clickUiObject(BY_TEXT, "My Videos", true); logger.start(); - clickUiObject(BY_ID, packageID + "thumbnail", true); + playFirstVideo(); logger.stop(); } else if (SOURCE_TRENDING.equalsIgnoreCase(source)) { - clickUiObject(BY_DESC, "Trending"); + clickUiObject(BY_DESC, "Explore", true); + clickUiObject(BY_DESC, "Trending", true); logger.start(); - clickUiObject(BY_ID, packageID + "thumbnail", true); + playFirstVideo(); logger.stop(); } else { // homepage videos @@ -198,7 +204,7 @@ public class UiAutomation extends BaseUiAutomation { } logger.start(); - clickUiObject(BY_ID, packageID + "thumbnail", true); + playFirstVideo(); logger.stop(); }