1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-03-13 22:28:36 +00:00

Merge pull request #40 from jimboatarm/workload_refactorings

Minor refactoring of uxperf workloads
This commit is contained in:
jimboatarm 2016-06-01 11:30:41 +01:00
commit 9393bfb888
9 changed files with 27 additions and 12 deletions

View File

@ -56,7 +56,7 @@ public class UiAutomation extends UxPerfUiAutomation {
public void clearFirstRunDialogues() throws Exception {
// The first run dialogues vary on different devices so check if they are there and dismiss
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()) {
gotItBox.clickAndWaitForNewWindow(timeout);
}
@ -96,7 +96,8 @@ public class UiAutomation extends UxPerfUiAutomation {
public boolean hasComposeView() throws Exception {
UiObject composeView = new UiObject(new UiSelector().resourceId("com.google.android.gm:id/compose"));
return composeView.waitForExists(networkTimeout);
return composeView.waitForExists(timeout);
}
public void setToField(final Bundle parameters) throws Exception {

View File

@ -121,12 +121,21 @@ class Googlephotos(AndroidUiAutoBenchmark):
def teardown(self, context):
super(Googlephotos, self).teardown(context)
regex = re.compile(r'^\w+~\d+\.jpg$')
for entry in self.device.listdir(self.device.working_directory):
match = regex.search(entry)
if entry.endswith(".log"):
self.device.pull_file(os.path.join(self.device.working_directory, entry),
context.output_directory)
self.device.delete_file(os.path.join(self.device.working_directory, entry))
# Clean up edited files on each iteration
if match:
self.device.delete_file(os.path.join(self.device.working_directory, entry))
self.device.execute('am broadcast -a android.intent.action.MEDIA_MOUNTED -d file:///sdcard')
def finalize(self, context):
super(Googlephotos, self).finalize(context)

View File

@ -47,6 +47,7 @@ public class UiAutomation extends UxPerfUiAutomation {
setScreenOrientation(ScreenOrientation.NATURAL);
confirmAccess();
dismissWelcomeView();
selectWorkingGallery();
gesturesTest();
editPhotoColorTest();
cropPhotoTest();
@ -68,16 +69,15 @@ public class UiAutomation extends UxPerfUiAutomation {
UiObject getStartedButton =
new UiObject(new UiSelector().textContains("Get started")
.className("android.widget.Button"));
.className("android.widget.Button"));
waitObject(getStartedButton, viewTimeoutSecs);
getStartedButton.clickAndWaitForNewWindow();
getStartedButton.click();
UiObject welcomeButton =
getUiObjectByResourceId("com.google.android.apps.photos:id/name",
"android.widget.TextView");
welcomeButton.clickAndWaitForNewWindow();
welcomeButton.click();
UiObject useWithoutAccount =
getUiObjectByText("Use without an account", "android.widget.TextView");
@ -380,11 +380,14 @@ public class UiAutomation extends UxPerfUiAutomation {
return result;
}
// Helper to click on an individual photograph based on index in wa-working gallery.
public void selectPhoto(final int index) throws Exception {
// Helper to click on the wa-working gallery.
public void selectWorkingGallery() throws Exception {
UiObject workdir = getUiObjectByText("wa-working", "android.widget.TextView");
workdir.clickAndWaitForNewWindow();
}
// Helper to click on an individual photograph based on index in wa-working gallery.
public void selectPhoto(final int index) throws Exception {
UiObject photo =
new UiObject(new UiSelector().resourceId("com.google.android.apps.photos:id/recycler_view")
.childSelector(new UiSelector()
@ -413,9 +416,6 @@ public class UiAutomation extends UxPerfUiAutomation {
// gallery. After long clicking it tags the photograph with a tick in the
// corner of the image to indicate that the photograph has been selected
public void tagPhoto(final int index) throws Exception {
UiObject workdir = getUiObjectByText("wa-working", "android.widget.TextView");
workdir.clickAndWaitForNewWindow();
UiObject photo =
new UiObject(new UiSelector().resourceId("com.google.android.apps.photos:id/recycler_view")
.childSelector(new UiSelector()

View File

@ -28,6 +28,7 @@ public class UiAutomation extends UxPerfUiAutomation {
confirmAccess();
googlephotos.dismissWelcomeView();
googlephotos.selectWorkingGallery();
// select the first photo
googlephotos.tagPhoto(0);
@ -90,6 +91,8 @@ public class UiAutomation extends UxPerfUiAutomation {
shareUsingApp("Skype");
skype.handleLoginScreen(loginName, loginPass);
confirmAccess();
sleep(10); // Pause while the app settles before returning
}
private void sendToSkype() throws Exception {

View File

@ -18,6 +18,7 @@ package com.arm.wlauto.uiauto.skype;
import java.io.File;
import java.util.TreeMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import android.app.Activity;
import android.os.Bundle;
@ -48,7 +49,7 @@ public class UiAutomation extends UxPerfUiAutomation {
public void runUiAutomation() throws Exception {
// Override superclass value
this.waitTimeout = 10000;
this.waitTimeout = TimeUnit.SECONDS.toMillis(10);
// Get Params
Bundle parameters = getParams();
@ -132,6 +133,7 @@ public class UiAutomation extends UxPerfUiAutomation {
.childSelector(new UiSelector()
.index(0)
.clickable(true)));
peopleItem.waitForExists(timeout);
peopleItem.click();
UiObject confirm =
getUiObjectByResourceId("com.skype.raider:id/fab", "android.widget.ImageView");