1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-02-21 12:28:44 +00:00

AdobeReader: Updated workload for new app version

Updated the workload to work with the latest version (v16.4)
of Adobe Reader app.
This commit is contained in:
Marc Bonnici 2016-12-05 12:37:16 +00:00
parent c7de8cabd6
commit b6f770cfc5
2 changed files with 71 additions and 10 deletions

View File

@ -69,6 +69,13 @@ public class UiAutomation extends UxPerfUiAutomation {
welcomeView.swipeLeft(10); welcomeView.swipeLeft(10);
welcomeView.swipeLeft(10); welcomeView.swipeLeft(10);
UiObject onboarding_finish_button =
new UiObject(new UiSelector().resourceId("com.adobe.reader:id/onboarding_finish_button"));
if (!onboarding_finish_button.exists()) {
welcomeView.swipeLeft(10);
}
clickUiObject(BY_ID, packageID + "onboarding_finish_button", "android.widget.Button"); clickUiObject(BY_ID, packageID + "onboarding_finish_button", "android.widget.Button");
// Deal with popup dialog message promoting Dropbox access // Deal with popup dialog message promoting Dropbox access
@ -113,8 +120,10 @@ public class UiAutomation extends UxPerfUiAutomation {
searchButton.click(); searchButton.click();
// Enter search text into the file searchBox. This will automatically filter the list. // Enter search text into the file searchBox. This will automatically filter the list.
UiObject searchBox = getUiObjectByResourceId("android:id/search_src_text", UiObject searchBox =
"android.widget.EditText"); new UiObject(new UiSelector().resourceIdMatches(".*search_src_text")
.classNameMatches("android.widget.Edit.*"));
searchBox.setText(filename); searchBox.setText(filename);
// Open a file from a file list view by searching for UiObjects containing the doc title. // Open a file from a file list view by searching for UiObjects containing the doc title.
@ -200,6 +209,14 @@ public class UiAutomation extends UxPerfUiAutomation {
tapDisplayCentre(); tapDisplayCentre();
} }
if (!searchIcon.waitForExists(uiAutoTimeout)) {
searchIcon =
new UiObject(new UiSelector().resourceId(packageID + "document_view_search"));
if (!searchIcon.waitForExists(uiAutoTimeout)) {
tapDisplayCentre();
}
}
for (int i = 0; i < searchStrings.length; i++) { for (int i = 0; i < searchStrings.length; i++) {
String runName = String.format(testTag + "_string" + i); String runName = String.format(testTag + "_string" + i);
ActionLogger logger = new ActionLogger(runName, parameters); ActionLogger logger = new ActionLogger(runName, parameters);
@ -208,8 +225,10 @@ public class UiAutomation extends UxPerfUiAutomation {
// so click the box again and press Enter to start the search. // so click the box again and press Enter to start the search.
searchIcon.clickAndWaitForNewWindow(); searchIcon.clickAndWaitForNewWindow();
UiObject searchBox = getUiObjectByResourceId("android:id/search_src_text", UiObject searchBox =
"android.widget.EditText"); new UiObject(new UiSelector().resourceIdMatches(".*search_src_text")
.className("android.widget.EditText"));
searchBox.setText(searchStrings[i]); searchBox.setText(searchStrings[i]);
logger.start(); logger.start();
@ -227,21 +246,63 @@ public class UiAutomation extends UxPerfUiAutomation {
logger.stop(); logger.stop();
// Get back to the main document view by clicking twice on the close button // Get back to the main document view by clicking twice on the close button
UiObject searchCloseButton = clickUiObject(BY_ID, "android:id/search_close_btn", "android.widget.ImageView", true); UiObject searchCloseButton =
searchCloseButton.clickAndWaitForNewWindow(); new UiObject(new UiSelector().resourceIdMatches(".*search_close_btn")
.className("android.widget.ImageView"));
searchCloseButton.click();
if (searchCloseButton.exists()){
searchCloseButton.clickAndWaitForNewWindow();
}
else {
UiObject searchBackButton = getUiObjectByDescription("Collapse",
"android.widget.ImageButton");
searchBackButton.clickAndWaitForNewWindow();
}
} }
} }
private void exitDocument() throws Exception { private void exitDocument() throws Exception {
// Return from the document view to the file list view by pressing home and my documents. // Return from the document view to the file list view by pressing home and my documents.
UiObject actionBar =
new UiObject(new UiSelector().resourceIdMatches(".*action_bar.*")
.className("android.view.View"));
if (!actionBar.exists()){
tapDisplayCentre();
}
UiObject homeButton = UiObject homeButton =
new UiObject(new UiSelector().resourceId("android:id/home") new UiObject(new UiSelector().resourceId("android:id/home")
.className("android.widget.ImageView")); .className("android.widget.ImageView"));
if (!homeButton.waitForExists(uiAutoTimeout)) {
tapDisplayCentre(); //Newer version of app have a menu button instead of home button.
UiObject menuButton =
new UiObject(new UiSelector().description("Navigate up")
.classNameMatches("android.widget.Image.*"));
if (menuButton.exists()){
menuButton.clickAndWaitForNewWindow();
} }
homeButton.clickAndWaitForNewWindow(); else if (menuButton.exists()){
menuButton.clickAndWaitForNewWindow();
}
else {
menuButton =
new UiObject(new UiSelector().resourceIdMatches(".*up.*")
.classNameMatches("android.widget.Image.*"));
menuButton.clickAndWaitForNewWindow();
}
clickUiObject(BY_DESC, "My Documents", "android.widget.LinearLayout", true); clickUiObject(BY_DESC, "My Documents", "android.widget.LinearLayout", true);
clickUiObject(BY_ID, "android:id/up", "android.widget.ImageView", true);
UiObject searchBackButton =
new UiObject(new UiSelector().description("Collapse")
.className("android.widget.ImageButton"));
if (searchBackButton.exists()){
searchBackButton.click();
}
else {
clickUiObject(BY_ID, "android:id/up", "android.widget.ImageView", true);
}
} }
} }