1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2024-10-06 02:41:11 +01:00

Googleslides: Updating the workload to support the new range of huawei devices

This commit is contained in:
scott 2018-09-06 15:53:09 +01:00 committed by Marc Bonnici
parent b20b9f9cad
commit 0440c41266
2 changed files with 54 additions and 12 deletions

View File

@ -150,7 +150,7 @@ public class UiAutomation extends BaseUiAutomation {
// On some devices the images tabs is missing so we need select the local storage. // On some devices the images tabs is missing so we need select the local storage.
UiObject localDevice = mDevice.findObject(new UiSelector().textMatches(".*[GM]B free")); UiObject localDevice = mDevice.findObject(new UiSelector().textMatches(".*[GM]B free"));
if (!imagesFolder.waitForExists(WAIT_TIMEOUT_1SEC*10)) { if (!imagesFolder.waitForExists(WAIT_TIMEOUT_1SEC*10)) {
clickUiObject(BY_DESC, "Show roots"); showRoots();
} }
if (imagesFolder.exists()) { if (imagesFolder.exists()) {
imagesFolder.click(); imagesFolder.click();
@ -163,7 +163,7 @@ public class UiAutomation extends BaseUiAutomation {
internal_storage.click(); internal_storage.click();
} }
mDevice.pressBack(); mDevice.pressBack();
clickUiObject(BY_DESC, "Show roots"); showRoots();
} }
if (localDevice.exists()){ if (localDevice.exists()){
localDevice.click(); localDevice.click();
@ -178,8 +178,13 @@ public class UiAutomation extends BaseUiAutomation {
} }
folderEntry.clickAndWaitForNewWindow(); folderEntry.clickAndWaitForNewWindow();
UiObject picture = mDevice.findObject(new UiSelector().resourceId("com.android.documentsui:id/date").enabled(true)); UiObject picture = mDevice.findObject(new UiSelector().resourceId("com.android.documentsui:id/details"));
picture.click(); if (!picture.exists()) {
UiObject pictureAlternate = mDevice.findObject(new UiSelector().resourceId("com.android.documentsui:id/date").enabled(true));
pictureAlternate.click();
} else {
picture.click();
}
} }
public void insertShape(String shapeName) throws Exception { public void insertShape(String shapeName) throws Exception {
@ -231,16 +236,41 @@ public class UiAutomation extends BaseUiAutomation {
clickUiObject(BY_DESC, "Open presentation"); clickUiObject(BY_DESC, "Open presentation");
clickUiObject(BY_TEXT, "Device storage", true); clickUiObject(BY_TEXT, "Device storage", true);
clickUiObject(BY_DESC, "Navigate up");
UiObject workingDirectory = mDevice.findObject(new UiSelector().text(workingDirectoryName));
if (!workingDirectory.exists()) {
showRoots();
UiObject localDevice = mDevice.findObject(new UiSelector().textMatches(".*[GM]B free"));
localDevice.click();
UiObject folderEntry = mDevice.findObject(new UiSelector().textContains(workingDirectoryName));
UiScrollable list = new UiScrollable(new UiSelector().scrollable(true));
if (!folderEntry.exists() && list.waitForExists(WAIT_TIMEOUT_1SEC)) {
list.scrollIntoView(folderEntry);
} else {
folderEntry.waitForExists(WAIT_TIMEOUT_1SEC*10);
}
folderEntry.clickAndWaitForNewWindow();
}
UiScrollable list = UiScrollable list =
new UiScrollable(new UiSelector().className("android.widget.ListView")); new UiScrollable(new UiSelector().className("android.widget.ListView"));
list.scrollIntoView(new UiSelector().textMatches(workingDirectoryName)); if (list.exists()){
clickUiObject(BY_TEXT, workingDirectoryName); list.scrollIntoView(new UiSelector().textMatches(workingDirectoryName));
list.scrollIntoView(new UiSelector().textContains(docName)); clickUiObject(BY_TEXT, workingDirectoryName);
list.scrollIntoView(new UiSelector().textContains(docName));
} else {
UiScrollable listAlternate =
new UiScrollable(new UiSelector().className("android.support.v7.widget.RecyclerView"));
listAlternate.scrollIntoView(new UiSelector().textContains(docName));
}
logger.start(); logger.start();
clickUiObject(BY_TEXT, docName); clickUiObject(BY_TEXT, docName);
clickUiObject(BY_TEXT, "Open", "android.widget.Button", true); UiObject open =
mDevice.findObject(new UiSelector().text("Open"));
if (open.exists()) {
open.click();
}
logger.stop(); logger.stop();
} }
@ -273,6 +303,9 @@ public class UiAutomation extends BaseUiAutomation {
if (save.waitForExists(WAIT_TIMEOUT_1SEC)) { if (save.waitForExists(WAIT_TIMEOUT_1SEC)) {
save.click(); save.click();
} }
if (saveActionButton.waitForExists(WAIT_TIMEOUT_1SEC)) {
saveActionButton.click();
}
logger.stop(); logger.stop();
// Overwrite if prompted // Overwrite if prompted
@ -291,9 +324,8 @@ public class UiAutomation extends BaseUiAutomation {
String testTag = "document_delete"; String testTag = "document_delete";
ActionLogger logger = new ActionLogger(testTag, parameters); ActionLogger logger = new ActionLogger(testTag, parameters);
String filenameRegex = String.format(".*((%s)|([Uu]ntitled presentation)).pptx.*", docName);
UiObject doc = UiObject doc =
mDevice.findObject(new UiSelector().textMatches(filenameRegex)); mDevice.findObject(new UiSelector().textContains("WORKLOAD"));
UiObject moreActions = UiObject moreActions =
doc.getFromParent(new UiSelector().descriptionContains("More actions")); doc.getFromParent(new UiSelector().descriptionContains("More actions"));
@ -389,7 +421,11 @@ public class UiAutomation extends BaseUiAutomation {
insertShape(shapeName); insertShape(shapeName);
modifyShape(shapeName); modifyShape(shapeName);
mDevice.pressBack(); mDevice.pressBack();
mDevice.pressBack(); UiObject today =
mDevice.findObject(new UiSelector().text("Today"));
if (!today.exists()){
mDevice.pressBack();
}
sleep(1); sleep(1);
// Tidy up // Tidy up
@ -506,4 +542,10 @@ public class UiAutomation extends BaseUiAutomation {
window.click(); window.click();
} }
} }
private void showRoots() throws Exception {
UiObject rootMenu =
mDevice.findObject(new UiSelector().descriptionContains("Show root"));
rootMenu.click();
}
} }