1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-04-17 16:20:53 +01:00

Merge pull request from marcbonnici/googleslides

GoogleSlides and Books Fixes
This commit is contained in:
setrofim 2017-06-20 10:35:09 +01:00 committed by GitHub
commit 1168c1ada8
4 changed files with 27 additions and 5 deletions
wlauto/workloads
googleplaybooks
com.arm.wlauto.uiauto.googleplaybooks.apk
uiauto/app/src/main/java/com/arm/wlauto/uiauto/googleplaybooks
googleslides
com.arm.wlauto.uiauto.googleslides.apk
uiauto/app/src/main/java/com/arm/wlauto/uiauto/googleslides

@ -18,9 +18,11 @@ package com.arm.wlauto.uiauto.googleplaybooks;
import android.os.Bundle; import android.os.Bundle;
import android.support.test.runner.AndroidJUnit4; import android.support.test.runner.AndroidJUnit4;
import android.support.test.uiautomator.UiObject; import android.support.test.uiautomator.UiObject;
import android.support.test.uiautomator.UiObject2;
import android.support.test.uiautomator.UiObjectNotFoundException; import android.support.test.uiautomator.UiObjectNotFoundException;
import android.support.test.uiautomator.UiSelector; import android.support.test.uiautomator.UiSelector;
import android.support.test.uiautomator.UiWatcher; import android.support.test.uiautomator.UiWatcher;
import android.support.test.uiautomator.By;
import android.util.Log; import android.util.Log;
import com.arm.wlauto.uiauto.ApplaunchInterface; import com.arm.wlauto.uiauto.ApplaunchInterface;
@ -280,7 +282,8 @@ public void runUiAutomation() throws Exception {
// To correctly find the UiObject we need to specify the index also here // To correctly find the UiObject we need to specify the index also here
UiObject myLibrary = UiObject myLibrary =
mDevice.findObject(new UiSelector().className("android.widget.TextView") mDevice.findObject(new UiSelector().className("android.widget.TextView")
.textMatches(".*[lL]ibrary")); .textMatches(".*[lL]ibrary")
.index(3));
myLibrary.clickAndWaitForNewWindow(uiAutoTimeout); myLibrary.clickAndWaitForNewWindow(uiAutoTimeout);
logger.stop(); logger.stop();
} }
@ -299,7 +302,7 @@ public void runUiAutomation() throws Exception {
// Check that books are sorted by time added to library. This way we // Check that books are sorted by time added to library. This way we
// can assume any newly downloaded books will be visible on the first // can assume any newly downloaded books will be visible on the first
// screen. // screen.
clickUiObject(BY_ID, packageID + "menu_sort", "android.widget.TextView"); mDevice.findObject(By.res(packageID + "menu_sort")).click();
clickUiObject(BY_TEXT, "Recent", "android.widget.TextView"); clickUiObject(BY_TEXT, "Recent", "android.widget.TextView");
// When the book is first added to library it may not appear in // When the book is first added to library it may not appear in
// cardsGrid until it has been fully downloaded. Wait for fully // cardsGrid until it has been fully downloaded. Wait for fully

@ -21,8 +21,10 @@ import android.os.SystemClock;
import android.support.test.runner.AndroidJUnit4; import android.support.test.runner.AndroidJUnit4;
import android.support.test.uiautomator.Configurator; import android.support.test.uiautomator.Configurator;
import android.support.test.uiautomator.UiObject; import android.support.test.uiautomator.UiObject;
import android.support.test.uiautomator.UiObject2;
import android.support.test.uiautomator.UiScrollable; import android.support.test.uiautomator.UiScrollable;
import android.support.test.uiautomator.UiSelector; import android.support.test.uiautomator.UiSelector;
import android.support.test.uiautomator.By;
import com.arm.wlauto.uiauto.UxPerfUiAutomation; import com.arm.wlauto.uiauto.UxPerfUiAutomation;
@ -133,7 +135,22 @@ public class UiAutomation extends UxPerfUiAutomation {
if (!imagesFolder.waitForExists(WAIT_TIMEOUT_1SEC*10)) { if (!imagesFolder.waitForExists(WAIT_TIMEOUT_1SEC*10)) {
clickUiObject(BY_DESC, "Show roots"); clickUiObject(BY_DESC, "Show roots");
} }
imagesFolder.click(); if (imagesFolder.exists()) {
imagesFolder.click();
} else {
// On some chromebooks the images tabs is missing so we need select the local storage.
UiObject localDevice = mDevice.findObject(new UiSelector().textContains("Chromebook"));
// The local storage can hidden by default so we need to enable showing it.
if (!localDevice.exists()){
clickUiObject(BY_DESC, "More Options");
clickUiObject(BY_DESC, "More Options");
clickUiObject(BY_TEXT, "Show internal storage");
clickUiObject(BY_DESC, "Show roots");
}
localDevice.click();
}
UiObject folderEntry = mDevice.findObject(new UiSelector().textContains(workingDirectoryName)); UiObject folderEntry = mDevice.findObject(new UiSelector().textContains(workingDirectoryName));
UiScrollable list = new UiScrollable(new UiSelector().scrollable(true)); UiScrollable list = new UiScrollable(new UiSelector().scrollable(true));
@ -143,7 +160,9 @@ public class UiAutomation extends UxPerfUiAutomation {
folderEntry.waitForExists(WAIT_TIMEOUT_1SEC*10); folderEntry.waitForExists(WAIT_TIMEOUT_1SEC*10);
} }
folderEntry.clickAndWaitForNewWindow(); folderEntry.clickAndWaitForNewWindow();
clickUiObject(BY_ID, "com.android.documentsui:id/date", true);
UiObject picture = mDevice.findObject(new UiSelector().resourceId("com.android.documentsui:id/date").enabled(true));
picture.click();
} }
public void insertShape(String shapeName) throws Exception { public void insertShape(String shapeName) throws Exception {
@ -312,7 +331,7 @@ public class UiAutomation extends UxPerfUiAutomation {
uiDeviceSwipeHorizontal(0, getDisplayCentreWidth(), getDisplayCentreHeight() / 2, 10); uiDeviceSwipeHorizontal(0, getDisplayCentreWidth(), getDisplayCentreHeight() / 2, 10);
// clickUiObject(BY_DESC, "Open navigation drawer"); // clickUiObject(BY_DESC, "Open navigation drawer");
clickUiObject(BY_TEXT, "Settings", true); mDevice.findObject(By.text("Settings")).click();
clickUiObject(BY_TEXT, "Create PowerPoint"); clickUiObject(BY_TEXT, "Create PowerPoint");
mDevice.pressBack(); mDevice.pressBack();
logger.stop(); logger.stop();