mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-01-19 12:24:32 +00:00
workloads/gmail: Fix to use passed working directory parameter
In devlib the default working directory has changed causing the workload to look in the wrong directory, now the workload should use the passed working directory and extract the relevant name from there.
This commit is contained in:
parent
e5ed64d8d5
commit
cba773b5e6
@ -65,6 +65,10 @@ class Gmail(ApkUiautoWorkload):
|
|||||||
super(Gmail, self).init_resources(context)
|
super(Gmail, self).init_resources(context)
|
||||||
if self.target.get_sdk_version() >= 24 and 'com.google.android.apps.photos' not in self.target.list_packages():
|
if self.target.get_sdk_version() >= 24 and 'com.google.android.apps.photos' not in self.target.list_packages():
|
||||||
raise WorkloadError('gmail workload requires Google Photos to be installed for Android N onwards')
|
raise WorkloadError('gmail workload requires Google Photos to be installed for Android N onwards')
|
||||||
|
# Allows for getting working directory regardless if path ends with a '/'
|
||||||
|
work_dir = self.target.working_directory
|
||||||
|
work_dir = work_dir if work_dir[-1] != os.sep else work_dir[:-1]
|
||||||
|
self.gui.uiauto_params['workdir_name'] = self.target.path.basename(work_dir)
|
||||||
self.gui.uiauto_params['recipient'] = self.recipient
|
self.gui.uiauto_params['recipient'] = self.recipient
|
||||||
# Only accept certain image formats
|
# Only accept certain image formats
|
||||||
if os.path.splitext(self.test_image.lower())[1] not in ['.jpg', '.jpeg', '.png']:
|
if os.path.splitext(self.test_image.lower())[1] not in ['.jpg', '.jpeg', '.png']:
|
||||||
|
Binary file not shown.
@ -38,6 +38,7 @@ public class UiAutomation extends BaseUiAutomation implements ApplaunchInterface
|
|||||||
protected Bundle parameters;
|
protected Bundle parameters;
|
||||||
protected String packageID;
|
protected String packageID;
|
||||||
protected String recipient;
|
protected String recipient;
|
||||||
|
protected String workdir_name;
|
||||||
|
|
||||||
private int networkTimeoutSecs = 30;
|
private int networkTimeoutSecs = 30;
|
||||||
private long networkTimeout = TimeUnit.SECONDS.toMillis(networkTimeoutSecs);
|
private long networkTimeout = TimeUnit.SECONDS.toMillis(networkTimeoutSecs);
|
||||||
@ -47,6 +48,7 @@ public class UiAutomation extends BaseUiAutomation implements ApplaunchInterface
|
|||||||
parameters = getParams();
|
parameters = getParams();
|
||||||
packageID = getPackageID(parameters);
|
packageID = getPackageID(parameters);
|
||||||
recipient = parameters.getString("recipient");
|
recipient = parameters.getString("recipient");
|
||||||
|
workdir_name = parameters.getString("workdir_name");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -203,10 +205,10 @@ public class UiAutomation extends BaseUiAutomation implements ApplaunchInterface
|
|||||||
} else {
|
} else {
|
||||||
photos.click();
|
photos.click();
|
||||||
//Click wa folder image
|
//Click wa folder image
|
||||||
UiObject waFolder =
|
UiObject working_directory =
|
||||||
mDevice.findObject(new UiSelector().textContains("wa")
|
mDevice.findObject(new UiSelector().textContains(workdir_name)
|
||||||
.className("android.widget.TextView"));
|
.className("android.widget.TextView"));
|
||||||
if (!waFolder.waitForExists (uiAutoTimeout)) {
|
if (!working_directory.waitForExists (uiAutoTimeout)) {
|
||||||
UiObject refresh =
|
UiObject refresh =
|
||||||
getUiObjectByResourceId("com.google.android.apps.photos:id/image");
|
getUiObjectByResourceId("com.google.android.apps.photos:id/image");
|
||||||
refresh.clickAndWaitForNewWindow();
|
refresh.clickAndWaitForNewWindow();
|
||||||
@ -214,8 +216,8 @@ public class UiAutomation extends BaseUiAutomation implements ApplaunchInterface
|
|||||||
getUiObjectByResourceId("com.google.android.apps.photos:id/action_mode_close_button");
|
getUiObjectByResourceId("com.google.android.apps.photos:id/action_mode_close_button");
|
||||||
back.clickAndWaitForNewWindow();
|
back.clickAndWaitForNewWindow();
|
||||||
}
|
}
|
||||||
waFolder.waitForExists (uiAutoTimeout);
|
working_directory.waitForExists (uiAutoTimeout);
|
||||||
waFolder.click();
|
working_directory.click();
|
||||||
//Click test image
|
//Click test image
|
||||||
UiObject imageFileButton =
|
UiObject imageFileButton =
|
||||||
mDevice.findObject(new UiSelector().descriptionContains("Photo"));
|
mDevice.findObject(new UiSelector().descriptionContains("Photo"));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user