mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-01-19 12:24:32 +00:00
Merge pull request #358 from marcbonnici/uiautomator
UXPerfUiAutomation and AppShare Workload Updated
This commit is contained in:
commit
38b368eec2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -30,6 +30,16 @@ public class UxPerfUiAutomation extends BaseUiAutomation {
|
||||
packageID = packageName + ":id/";
|
||||
}
|
||||
|
||||
public void setWorkloadParameters(Bundle parameters, String packageName, String packageID){
|
||||
this.parameters = parameters;
|
||||
this.packageName = packageName;
|
||||
this.packageID = packageID;
|
||||
}
|
||||
|
||||
public String getPackageID(){
|
||||
return packageID;
|
||||
}
|
||||
|
||||
private Logger logger = Logger.getLogger(UxPerfUiAutomation.class.getName());
|
||||
|
||||
public enum GestureType { UIDEVICE_SWIPE, UIOBJECT_SWIPE, PINCH };
|
||||
|
@ -141,7 +141,7 @@ class AppShare(AndroidUxPerfWorkload):
|
||||
self.uiauto_params['recipient'] = self.email_recipient
|
||||
self.uiauto_params['my_id'] = self.skype_login_name
|
||||
self.uiauto_params['my_pwd'] = self.skype_login_pass
|
||||
self.uiauto_params['name'] = self.skype_contact_name.replace(' ', '0space0')
|
||||
self.uiauto_params['name'] = self.skype_contact_name
|
||||
# Only accept certain image formats
|
||||
if os.path.splitext(self.test_image.lower())[1] not in ['.jpg', '.jpeg', '.png']:
|
||||
raise ValidationError('{} must be a JPEG or PNG file'.format(self.test_image))
|
||||
|
Binary file not shown.
@ -39,20 +39,18 @@ public class UiAutomation extends UxPerfUiAutomation {
|
||||
// should not log actions themselves.
|
||||
Bundle dummyParams = new Bundle();
|
||||
dummyParams.putString("markers_enabled", "false");
|
||||
googlephotos.parameters = dummyParams;
|
||||
googlephotos.packageName = parameters.getString("googlephotos_package");
|
||||
googlephotos.packageID = googlephotos.packageName + ":id/";
|
||||
gmail.parameters = dummyParams;
|
||||
gmail.packageName = parameters.getString("gmail_package");
|
||||
gmail.packageID = gmail.packageName + ":id/";
|
||||
skype.parameters = dummyParams;
|
||||
skype.packageName = parameters.getString("skype_package");
|
||||
skype.packageID = skype.packageName + ":id/";
|
||||
|
||||
String packageName = parameters.getString("googlephotos_package");
|
||||
googlephotos.setWorkloadParameters(dummyParams, packageName, packageName + ":id/");
|
||||
packageName = parameters.getString("gmail_package");
|
||||
gmail.setWorkloadParameters(dummyParams, packageName, packageName + ":id/");
|
||||
packageName = parameters.getString("skype_package");
|
||||
skype.setWorkloadParameters(dummyParams, packageName, packageName + ":id/");
|
||||
|
||||
String recipient = parameters.getString("recipient");
|
||||
String loginName = parameters.getString("my_id");
|
||||
String loginPass = parameters.getString("my_pwd");
|
||||
String contactName = parameters.getString("name").replace("0space0", " ");
|
||||
String contactName = parameters.getString("name");
|
||||
|
||||
setScreenOrientation(ScreenOrientation.NATURAL);
|
||||
|
||||
@ -61,7 +59,15 @@ public class UiAutomation extends UxPerfUiAutomation {
|
||||
logIntoSkype(loginName, loginPass);
|
||||
// Skype won't allow us to login and share on first visit so invoke
|
||||
// once more from googlephotos
|
||||
pressBack();
|
||||
pressBack();
|
||||
|
||||
// On some devices the first back press only hides the keyboard, check if
|
||||
// another is needed.
|
||||
UiObject googlephotosShare = new UiObject(new UiSelector().packageName(
|
||||
parameters.getString("googlephotos_package")));
|
||||
if (!googlephotosShare.exists()){
|
||||
pressBack();
|
||||
}
|
||||
sendToSkype(contactName);
|
||||
|
||||
unsetScreenOrientation();
|
||||
@ -75,7 +81,7 @@ public class UiAutomation extends UxPerfUiAutomation {
|
||||
}
|
||||
|
||||
private void sendToGmail(String recipient) throws Exception {
|
||||
String gID = gmail.packageID;
|
||||
String gID = gmail.getPackageID();
|
||||
|
||||
shareUsingApp("Gmail", "gmail");
|
||||
|
||||
@ -121,11 +127,15 @@ public class UiAutomation extends UxPerfUiAutomation {
|
||||
|
||||
clickUiObject(BY_DESC, "Share", "android.widget.ImageView");
|
||||
UiScrollable applicationGrid =
|
||||
new UiScrollable(new UiSelector().resourceId(googlephotos.packageID + "application_grid"));
|
||||
new UiScrollable(new UiSelector().resourceId(googlephotos.getPackageID() + "application_grid"));
|
||||
if (!applicationGrid.exists()){
|
||||
applicationGrid =
|
||||
new UiScrollable(new UiSelector().resourceId(googlephotos.getPackageID() + "share_expander"));
|
||||
}
|
||||
UiObject openApp =
|
||||
new UiObject(new UiSelector().text(appName)
|
||||
.className("android.widget.TextView"));
|
||||
// On some devices the application_grid has many entries, se we have to swipe up to make
|
||||
// On some devices the application_grid has many entries, so we have to swipe up to make
|
||||
// sure all the entries are visable. This will also stop entries at the bottom being
|
||||
// obscured by the bottom action bar.
|
||||
applicationGrid.swipeUp(10);
|
||||
|
Loading…
x
Reference in New Issue
Block a user