mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-01-18 20:11:20 +00:00
workloads/youtube: Update Youtube workload
The previous known working version of the youtube apk appears to have stopped working. Update to support the new format.
This commit is contained in:
parent
5cfe452a35
commit
18439e3b31
@ -53,7 +53,7 @@ class Youtube(ApkUiautoWorkload):
|
|||||||
5. Scroll down to the end of related videos and comments under the info card, and then
|
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.
|
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']
|
package_names = ['com.google.android.youtube']
|
||||||
|
|
||||||
|
Binary file not shown.
@ -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 {
|
public void testPlayVideo(String source, String searchTerm) throws Exception {
|
||||||
String testTag = "play";
|
String testTag = "play";
|
||||||
ActionLogger logger = new ActionLogger(testTag + "_" + source, parameters);
|
ActionLogger logger = new ActionLogger(testTag + "_" + source, parameters);
|
||||||
@ -162,16 +170,13 @@ public class UiAutomation extends BaseUiAutomation {
|
|||||||
mDevice.pressEnter();
|
mDevice.pressEnter();
|
||||||
// If a video exists whose title contains the exact search term, then play it
|
// If a video exists whose title contains the exact search term, then play it
|
||||||
// Otherwise click the first video in the search results
|
// Otherwise click the first video in the search results
|
||||||
UiObject thumbnail =
|
UiObject matchedVideo = mDevice.findObject(new UiSelector().descriptionContains(searchTerm));
|
||||||
mDevice.findObject(new UiSelector().resourceId(packageID + "thumbnail"));
|
|
||||||
UiObject matchedVideo =
|
|
||||||
thumbnail.getFromParent(new UiSelector().textContains(searchTerm));
|
|
||||||
|
|
||||||
logger.start();
|
logger.start();
|
||||||
if (matchedVideo.exists()) {
|
if (matchedVideo.exists()) {
|
||||||
matchedVideo.clickAndWaitForNewWindow();
|
matchedVideo.clickAndWaitForNewWindow();
|
||||||
} else {
|
} else {
|
||||||
thumbnail.clickAndWaitForNewWindow();
|
playFirstVideo();
|
||||||
}
|
}
|
||||||
logger.stop();
|
logger.stop();
|
||||||
|
|
||||||
@ -180,14 +185,15 @@ public class UiAutomation extends BaseUiAutomation {
|
|||||||
clickUiObject(BY_TEXT, "My Videos", true);
|
clickUiObject(BY_TEXT, "My Videos", true);
|
||||||
|
|
||||||
logger.start();
|
logger.start();
|
||||||
clickUiObject(BY_ID, packageID + "thumbnail", true);
|
playFirstVideo();
|
||||||
logger.stop();
|
logger.stop();
|
||||||
|
|
||||||
} else if (SOURCE_TRENDING.equalsIgnoreCase(source)) {
|
} else if (SOURCE_TRENDING.equalsIgnoreCase(source)) {
|
||||||
clickUiObject(BY_DESC, "Trending");
|
clickUiObject(BY_DESC, "Explore", true);
|
||||||
|
clickUiObject(BY_DESC, "Trending", true);
|
||||||
|
|
||||||
logger.start();
|
logger.start();
|
||||||
clickUiObject(BY_ID, packageID + "thumbnail", true);
|
playFirstVideo();
|
||||||
logger.stop();
|
logger.stop();
|
||||||
|
|
||||||
} else { // homepage videos
|
} else { // homepage videos
|
||||||
@ -198,7 +204,7 @@ public class UiAutomation extends BaseUiAutomation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
logger.start();
|
logger.start();
|
||||||
clickUiObject(BY_ID, packageID + "thumbnail", true);
|
playFirstVideo();
|
||||||
logger.stop();
|
logger.stop();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user