1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-01-31 02:01:16 +00:00

workloads/googleslides: Misc Fixes:

- Move the slide editing test into the main runWorkload instead of
setup.
- On some devices the folder picker has changed layout so add support for
navigating.
- Add support for differently capitalized splash buttons.
- Add workaround for adding a new slide if click the button doesn't work
the first time.
This commit is contained in:
Marc Bonnici 2018-12-21 10:32:23 +00:00
parent 755417f139
commit 8770888685
2 changed files with 39 additions and 12 deletions

View File

@ -81,11 +81,11 @@ public class UiAutomation extends BaseUiAutomation {
sleep(1); sleep(1);
enablePowerpointCompat(); enablePowerpointCompat();
sleep(1); sleep(1);
testEditNewSlidesDocument(newDocumentName, workingDirectoryName, doTextEntry);
} }
@Test @Test
public void runWorkload() throws Exception { public void runWorkload() throws Exception {
testEditNewSlidesDocument(newDocumentName, workingDirectoryName, doTextEntry);
openDocument(pushedDocumentName, workingDirectoryName); openDocument(pushedDocumentName, workingDirectoryName);
waitForProgress(WAIT_TIMEOUT_1SEC*30); waitForProgress(WAIT_TIMEOUT_1SEC*30);
testSlideshowFromStorage(slideCount); testSlideshowFromStorage(slideCount);
@ -130,8 +130,22 @@ public class UiAutomation extends BaseUiAutomation {
} }
public void insertSlide(String slideLayout) throws Exception { public void insertSlide(String slideLayout) throws Exception {
clickUiObject(BY_DESC, "Add slide", true); UiObject add_slide =
clickUiObject(BY_TEXT, slideLayout, true); mDevice.findObject(new UiSelector().descriptionContains("Add slide"));
add_slide.click();
UiObject slide_layout = mDevice.findObject(new UiSelector().textContains(slideLayout));
if (!slide_layout.exists()){
tapOpenArea();
UiObject done_button = mDevice.findObject(new UiSelector().resourceId("android:id/action_mode_close_button"));
if (done_button.exists()){
done_button.click();
}
add_slide.click();
}
slide_layout.click();
} }
public void insertImage(String workingDirectoryName) throws Exception { public void insertImage(String workingDirectoryName) throws Exception {
@ -165,7 +179,7 @@ public class UiAutomation extends BaseUiAutomation {
mDevice.pressBack(); mDevice.pressBack();
showRoots(); showRoots();
} }
if (localDevice.exists()){ else if (localDevice.exists()){
localDevice.click(); localDevice.click();
} }
@ -185,6 +199,10 @@ public class UiAutomation extends BaseUiAutomation {
} else { } else {
picture.click(); picture.click();
} }
UiObject done_button = mDevice.findObject(new UiSelector().resourceId("android:id/action_mode_close_button"));
if (done_button.exists()){
done_button.click();
}
} }
public void insertShape(String shapeName) throws Exception { public void insertShape(String shapeName) throws Exception {
@ -238,20 +256,29 @@ public class UiAutomation extends BaseUiAutomation {
clickUiObject(BY_TEXT, "Device storage", true); clickUiObject(BY_TEXT, "Device storage", true);
UiObject workingDirectory = mDevice.findObject(new UiSelector().text(workingDirectoryName)); UiObject workingDirectory = mDevice.findObject(new UiSelector().text(workingDirectoryName));
if (!workingDirectory.exists()) { UiObject nav_button = mDevice.findObject(new UiSelector().resourceId(packageID + "file_picker_nav_up_btn"));
UiObject folderEntry = mDevice.findObject(new UiSelector().textContains(workingDirectoryName));
if (workingDirectory.exists()) {
folderEntry.clickAndWaitForNewWindow();
}
else if (nav_button.exists()) {
while (nav_button.exists()) {
nav_button.click();
}
clickUiObject(BY_TEXT, "Internal Storage", true);
}
else {
showRoots(); showRoots();
UiObject localDevice = mDevice.findObject(new UiSelector().textMatches(".*[GM]B free")); UiObject localDevice = mDevice.findObject(new UiSelector().textMatches(".*[GM]B free"));
localDevice.click(); localDevice.click();
UiObject folderEntry = mDevice.findObject(new UiSelector().textContains(workingDirectoryName));
UiScrollable list = new UiScrollable(new UiSelector().scrollable(true)); UiScrollable list = new UiScrollable(new UiSelector().scrollable(true));
if (!folderEntry.exists() && list.waitForExists(WAIT_TIMEOUT_1SEC)) { if (!folderEntry.exists() && list.waitForExists(WAIT_TIMEOUT_1SEC)) {
list.scrollIntoView(folderEntry); list.scrollIntoView(folderEntry);
} else { } else {
folderEntry.waitForExists(WAIT_TIMEOUT_1SEC*10); 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"));
if (list.exists()){ if (list.exists()){
@ -266,7 +293,7 @@ public class UiAutomation extends BaseUiAutomation {
logger.start(); logger.start();
clickUiObject(BY_TEXT, docName); clickUiObject(BY_TEXT, docName);
UiObject open = UiObject open =
mDevice.findObject(new UiSelector().text("Open")); mDevice.findObject(new UiSelector().text("Open"));
if (open.exists()) { if (open.exists()) {
open.click(); open.click();
@ -369,7 +396,7 @@ public class UiAutomation extends BaseUiAutomation {
protected void skipWelcomeScreen() throws Exception { protected void skipWelcomeScreen() throws Exception {
UiObject skip = UiObject skip =
mDevice.findObject(new UiSelector().textMatches("Skip")); mDevice.findObject(new UiSelector().textMatches("Skip|SKIP"));
if (skip.exists()) { if (skip.exists()) {
skip.click(); skip.click();
} }
@ -421,7 +448,7 @@ public class UiAutomation extends BaseUiAutomation {
insertShape(shapeName); insertShape(shapeName);
modifyShape(shapeName); modifyShape(shapeName);
mDevice.pressBack(); mDevice.pressBack();
UiObject today = UiObject today =
mDevice.findObject(new UiSelector().text("Today")); mDevice.findObject(new UiSelector().text("Today"));
if (!today.exists()){ if (!today.exists()){
mDevice.pressBack(); mDevice.pressBack();
@ -542,7 +569,7 @@ public class UiAutomation extends BaseUiAutomation {
window.click(); window.click();
} }
} }
private void showRoots() throws Exception { private void showRoots() throws Exception {
UiObject rootMenu = UiObject rootMenu =
mDevice.findObject(new UiSelector().descriptionContains("Show root")); mDevice.findObject(new UiSelector().descriptionContains("Show root"));