1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-03-21 01:59:13 +00:00

Remove redundant clickUiObject method

Remove the clickUiObject method from the base class and refactor the
gmail workload to use clickAndWaitForWindow methods instead. For quick
popup menus prefer simple click events.
This commit is contained in:
John Richardson 2016-05-26 17:34:05 +01:00
parent 64f6720a36
commit 573c9b3226
5 changed files with 6 additions and 12 deletions

View File

@ -143,12 +143,6 @@ public class BaseUiAutomation extends UiAutomatorTestCase {
return object; return object;
} }
public void clickUiObject(UiObject uiobject, long timeout) throws Exception {
if (!uiobject.clickAndWaitForNewWindow(timeout)) {
throw new UiObjectNotFoundException(String.format("Timeout waiting for New Window"));
}
}
public int getDisplayHeight () { public int getDisplayHeight () {
return getUiDevice().getInstance().getDisplayHeight(); return getUiDevice().getInstance().getDisplayHeight();
} }

View File

@ -58,12 +58,12 @@ public class UiAutomation extends UxPerfUiAutomation {
UiObject gotItBox = new UiObject(new UiSelector().resourceId("com.google.android.gm:id/welcome_tour_got_it") UiObject gotItBox = new UiObject(new UiSelector().resourceId("com.google.android.gm:id/welcome_tour_got_it")
.className("android.widget.TextView")); .className("android.widget.TextView"));
if (gotItBox.exists()) { if (gotItBox.exists()) {
clickUiObject(gotItBox, timeout); gotItBox.clickAndWaitForNewWindow(timeout);
} }
UiObject takeMeToBox = new UiObject(new UiSelector().textContains("Take me to Gmail") UiObject takeMeToBox = new UiObject(new UiSelector().textContains("Take me to Gmail")
.className("android.widget.TextView")); .className("android.widget.TextView"));
if (takeMeToBox.exists()) { if (takeMeToBox.exists()) {
clickUiObject(takeMeToBox, timeout); takeMeToBox.clickAndWaitForNewWindow(timeout);
} }
UiObject syncNowButton = new UiObject(new UiSelector().textContains("Sync now") UiObject syncNowButton = new UiObject(new UiSelector().textContains("Sync now")
@ -89,7 +89,7 @@ public class UiAutomation extends UxPerfUiAutomation {
Timer result = new Timer(); Timer result = new Timer();
UiObject newMailButton = getUiObjectByDescription("Compose", "android.widget.ImageButton"); UiObject newMailButton = getUiObjectByDescription("Compose", "android.widget.ImageButton");
result.start(); result.start();
clickUiObject(newMailButton, timeout); newMailButton.clickAndWaitForNewWindow(timeout);
result.end(); result.end();
timingResults.put("Create_newMail", result); timingResults.put("Create_newMail", result);
} }
@ -136,7 +136,7 @@ public class UiAutomation extends UxPerfUiAutomation {
Timer result = new Timer(); Timer result = new Timer();
UiObject sendButton = getUiObjectByDescription("Send", "android.widget.TextView"); UiObject sendButton = getUiObjectByDescription("Send", "android.widget.TextView");
result.start(); result.start();
clickUiObject(sendButton, timeout); sendButton.clickAndWaitForNewWindow(timeout);
result.end(); result.end();
timingResults.put("Create_Send", result); timingResults.put("Create_Send", result);
@ -153,9 +153,9 @@ public class UiAutomation extends UxPerfUiAutomation {
Timer result = new Timer(); Timer result = new Timer();
result.start(); result.start();
clickUiObject(attachIcon, timeout); attachIcon.click();
UiObject attachFile = getUiObjectByText("Attach file", "android.widget.TextView"); UiObject attachFile = getUiObjectByText("Attach file", "android.widget.TextView");
clickUiObject(attachFile, timeout); attachFile.clickAndWaitForNewWindow(timeout);
UiObject titleIsWaWorking = new UiObject(new UiSelector() UiObject titleIsWaWorking = new UiObject(new UiSelector()
.className("android.widget.TextView") .className("android.widget.TextView")