1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-03-14 14:48:53 +00:00

Merging master into googlephotos

This commit is contained in:
John Richardson 2016-05-06 22:36:48 +01:00
commit 3b898125b0
8 changed files with 24 additions and 4 deletions

View File

@ -17,7 +17,8 @@ public class UiAutomation extends UxPerfUiAutomation {
public static String TAG = "uxperf_gmail";
private Bundle parameters;
private long networkTimeout = TimeUnit.SECONDS.toMillis(20);
private int networkTimeoutSecs = 20;
private long networkTimeout = TimeUnit.SECONDS.toMillis(networkTimeoutSecs);
private LinkedHashMap<String, Timer> timingResults = new LinkedHashMap<String, Timer>();
public void runUiAutomation() throws Exception {
@ -26,10 +27,10 @@ public class UiAutomation extends UxPerfUiAutomation {
clearFirstRunDialogues();
clickNewMail();
attachFiles();
setToField();
setSubjectField();
setComposeField();
attachFiles();
clickSendButton();
writeResultsToFile(timingResults, parameters.getString("output_file"));
@ -61,7 +62,7 @@ public class UiAutomation extends UxPerfUiAutomation {
public void setToField() throws Exception {
Timer result = new Timer();
UiObject toField = getUiObjectByDescription("To", "android.widget.TextView");
UiObject toField = getUiObjectByText("To", "android.widget.TextView");
String recipient = parameters.getString("recipient").replace('_', ' ');
result.start();
toField.setText(recipient);
@ -74,6 +75,8 @@ public class UiAutomation extends UxPerfUiAutomation {
Timer result = new Timer();
UiObject subjectField = getUiObjectByText("Subject", "android.widget.EditText");
result.start();
// Click on the subject field is required on some platforms to exit the To box cleanly
subjectField.click();
subjectField.setText("This is a test message");
getUiDevice().pressEnter();
result.end();
@ -97,6 +100,10 @@ public class UiAutomation extends UxPerfUiAutomation {
clickUiObject(sendButton, timeout);
result.end();
timingResults.put("Send", result);
UiObject drawerButton = new UiObject(new UiSelector().descriptionContains("avigat")
.className("android.widget.ImageButton"));
waitObject(drawerButton, networkTimeoutSecs);
}
public void attachFiles() throws Exception {

View File

@ -86,6 +86,9 @@ public class UiAutomation extends UxPerfUiAutomation {
getUiObjectByResourceId("com.google.android.apps.photos:id/next_button",
"android.widget.ImageView");
nextButton.clickAndWaitForNewWindow();
UiObject workingFolder = new UiObject(new UiSelector().text("wa-working"));
waitObject(workingFolder, viewTimeoutSecs);
}
private void gesturesTest() throws Exception {

View File

@ -287,7 +287,7 @@ public class UiAutomation extends UxPerfUiAutomation {
UiObject searchBox = getUiObjectByResourceId("android:id/search_src_text",
"android.widget.EditText");
searchBox.setText(searchText);
searchBox.click();
getUiDevice().getInstance().pressSearch();
Timer result = new Timer();
result.start();
getUiDevice().getInstance().pressEnter();

View File

@ -49,6 +49,7 @@ public class UiAutomation extends UxPerfUiAutomation {
// Run tests
handleLoginScreen(loginName, loginPass);
confirmLocalFileAccess();
selectContact(contactName, contactSkypeId);
if ("video".equalsIgnoreCase(callType)) {
videoCallTest(callDuration);
@ -76,6 +77,15 @@ public class UiAutomation extends UxPerfUiAutomation {
signinButton.clickAndWaitForNewWindow();
}
private void confirmLocalFileAccess() throws Exception {
// First time run requires confirmation to allow access to local files
UiObject allowButton = new UiObject(new UiSelector().textContains("Allow")
.className("android.widget.Button"));
if (allowButton.waitForExists(timeout)) {
allowButton.clickAndWaitForNewWindow(timeout);
}
}
private void selectContact(String name, String id) throws Exception {
Timer timer = new Timer();
timer.start();