mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-03-21 01:59:13 +00:00
Minor refactoring of uxperf workloads
Delete saved images during teardown of googlephotos workload. Refactor selectPhoto helper method in googlephotos and add pause in Multiapp workload for stability. Includes minor fixes.
This commit is contained in:
parent
a50a17a94e
commit
801027661f
Binary file not shown.
@ -56,7 +56,7 @@ public class UiAutomation extends UxPerfUiAutomation {
|
|||||||
public void clearFirstRunDialogues() throws Exception {
|
public void clearFirstRunDialogues() throws Exception {
|
||||||
// The first run dialogues vary on different devices so check if they are there and dismiss
|
// 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")
|
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()) {
|
||||||
gotItBox.clickAndWaitForNewWindow(timeout);
|
gotItBox.clickAndWaitForNewWindow(timeout);
|
||||||
}
|
}
|
||||||
@ -96,7 +96,8 @@ public class UiAutomation extends UxPerfUiAutomation {
|
|||||||
|
|
||||||
public boolean hasComposeView() throws Exception {
|
public boolean hasComposeView() throws Exception {
|
||||||
UiObject composeView = new UiObject(new UiSelector().resourceId("com.google.android.gm:id/compose"));
|
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 {
|
public void setToField(final Bundle parameters) throws Exception {
|
||||||
|
@ -121,12 +121,21 @@ class Googlephotos(AndroidUiAutoBenchmark):
|
|||||||
def teardown(self, context):
|
def teardown(self, context):
|
||||||
super(Googlephotos, self).teardown(context)
|
super(Googlephotos, self).teardown(context)
|
||||||
|
|
||||||
|
regex = re.compile(r'^\w+~\d+\.jpg$')
|
||||||
|
|
||||||
for entry in self.device.listdir(self.device.working_directory):
|
for entry in self.device.listdir(self.device.working_directory):
|
||||||
|
match = regex.search(entry)
|
||||||
if entry.endswith(".log"):
|
if entry.endswith(".log"):
|
||||||
self.device.pull_file(os.path.join(self.device.working_directory, entry),
|
self.device.pull_file(os.path.join(self.device.working_directory, entry),
|
||||||
context.output_directory)
|
context.output_directory)
|
||||||
self.device.delete_file(os.path.join(self.device.working_directory, entry))
|
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):
|
def finalize(self, context):
|
||||||
super(Googlephotos, self).finalize(context)
|
super(Googlephotos, self).finalize(context)
|
||||||
|
|
||||||
|
Binary file not shown.
@ -47,6 +47,7 @@ public class UiAutomation extends UxPerfUiAutomation {
|
|||||||
setScreenOrientation(ScreenOrientation.NATURAL);
|
setScreenOrientation(ScreenOrientation.NATURAL);
|
||||||
confirmAccess();
|
confirmAccess();
|
||||||
dismissWelcomeView();
|
dismissWelcomeView();
|
||||||
|
selectWorkingGallery();
|
||||||
gesturesTest();
|
gesturesTest();
|
||||||
editPhotoColorTest();
|
editPhotoColorTest();
|
||||||
cropPhotoTest();
|
cropPhotoTest();
|
||||||
@ -68,16 +69,15 @@ public class UiAutomation extends UxPerfUiAutomation {
|
|||||||
|
|
||||||
UiObject getStartedButton =
|
UiObject getStartedButton =
|
||||||
new UiObject(new UiSelector().textContains("Get started")
|
new UiObject(new UiSelector().textContains("Get started")
|
||||||
.className("android.widget.Button"));
|
.className("android.widget.Button"));
|
||||||
|
|
||||||
waitObject(getStartedButton, viewTimeoutSecs);
|
waitObject(getStartedButton, viewTimeoutSecs);
|
||||||
|
getStartedButton.click();
|
||||||
getStartedButton.clickAndWaitForNewWindow();
|
|
||||||
|
|
||||||
UiObject welcomeButton =
|
UiObject welcomeButton =
|
||||||
getUiObjectByResourceId("com.google.android.apps.photos:id/name",
|
getUiObjectByResourceId("com.google.android.apps.photos:id/name",
|
||||||
"android.widget.TextView");
|
"android.widget.TextView");
|
||||||
welcomeButton.clickAndWaitForNewWindow();
|
welcomeButton.click();
|
||||||
|
|
||||||
UiObject useWithoutAccount =
|
UiObject useWithoutAccount =
|
||||||
getUiObjectByText("Use without an account", "android.widget.TextView");
|
getUiObjectByText("Use without an account", "android.widget.TextView");
|
||||||
@ -380,11 +380,14 @@ public class UiAutomation extends UxPerfUiAutomation {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper to click on an individual photograph based on index in wa-working gallery.
|
// Helper to click on the wa-working gallery.
|
||||||
public void selectPhoto(final int index) throws Exception {
|
public void selectWorkingGallery() throws Exception {
|
||||||
UiObject workdir = getUiObjectByText("wa-working", "android.widget.TextView");
|
UiObject workdir = getUiObjectByText("wa-working", "android.widget.TextView");
|
||||||
workdir.clickAndWaitForNewWindow();
|
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 =
|
UiObject photo =
|
||||||
new UiObject(new UiSelector().resourceId("com.google.android.apps.photos:id/recycler_view")
|
new UiObject(new UiSelector().resourceId("com.google.android.apps.photos:id/recycler_view")
|
||||||
.childSelector(new UiSelector()
|
.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
|
// 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
|
// corner of the image to indicate that the photograph has been selected
|
||||||
public void tagPhoto(final int index) throws Exception {
|
public void tagPhoto(final int index) throws Exception {
|
||||||
UiObject workdir = getUiObjectByText("wa-working", "android.widget.TextView");
|
|
||||||
workdir.clickAndWaitForNewWindow();
|
|
||||||
|
|
||||||
UiObject photo =
|
UiObject photo =
|
||||||
new UiObject(new UiSelector().resourceId("com.google.android.apps.photos:id/recycler_view")
|
new UiObject(new UiSelector().resourceId("com.google.android.apps.photos:id/recycler_view")
|
||||||
.childSelector(new UiSelector()
|
.childSelector(new UiSelector()
|
||||||
|
Binary file not shown.
@ -28,6 +28,7 @@ public class UiAutomation extends UxPerfUiAutomation {
|
|||||||
|
|
||||||
confirmAccess();
|
confirmAccess();
|
||||||
googlephotos.dismissWelcomeView();
|
googlephotos.dismissWelcomeView();
|
||||||
|
googlephotos.selectWorkingGallery();
|
||||||
|
|
||||||
// select the first photo
|
// select the first photo
|
||||||
googlephotos.tagPhoto(0);
|
googlephotos.tagPhoto(0);
|
||||||
@ -90,6 +91,8 @@ public class UiAutomation extends UxPerfUiAutomation {
|
|||||||
shareUsingApp("Skype");
|
shareUsingApp("Skype");
|
||||||
skype.handleLoginScreen(loginName, loginPass);
|
skype.handleLoginScreen(loginName, loginPass);
|
||||||
confirmAccess();
|
confirmAccess();
|
||||||
|
|
||||||
|
sleep(10); // Pause while the app settles before returning
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendToSkype() throws Exception {
|
private void sendToSkype() throws Exception {
|
||||||
|
Binary file not shown.
@ -18,6 +18,7 @@ package com.arm.wlauto.uiauto.skype;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -48,7 +49,7 @@ public class UiAutomation extends UxPerfUiAutomation {
|
|||||||
|
|
||||||
public void runUiAutomation() throws Exception {
|
public void runUiAutomation() throws Exception {
|
||||||
// Override superclass value
|
// Override superclass value
|
||||||
this.waitTimeout = 10000;
|
this.waitTimeout = TimeUnit.SECONDS.toMillis(10);
|
||||||
|
|
||||||
// Get Params
|
// Get Params
|
||||||
Bundle parameters = getParams();
|
Bundle parameters = getParams();
|
||||||
@ -132,6 +133,7 @@ public class UiAutomation extends UxPerfUiAutomation {
|
|||||||
.childSelector(new UiSelector()
|
.childSelector(new UiSelector()
|
||||||
.index(0)
|
.index(0)
|
||||||
.clickable(true)));
|
.clickable(true)));
|
||||||
|
peopleItem.waitForExists(timeout);
|
||||||
peopleItem.click();
|
peopleItem.click();
|
||||||
UiObject confirm =
|
UiObject confirm =
|
||||||
getUiObjectByResourceId("com.skype.raider:id/fab", "android.widget.ImageView");
|
getUiObjectByResourceId("com.skype.raider:id/fab", "android.widget.ImageView");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user