mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-03-21 01:59:13 +00:00
Fixes for multiapp on latest version of apks
This commit is contained in:
parent
9393bfb888
commit
52104ba0cf
Binary file not shown.
@ -93,9 +93,12 @@ public class UiAutomation extends UxPerfUiAutomation {
|
|||||||
sleep(1);
|
sleep(1);
|
||||||
|
|
||||||
UiObject nextButton =
|
UiObject nextButton =
|
||||||
getUiObjectByResourceId("com.google.android.apps.photos:id/next_button",
|
new UiObject(new UiSelector().resourceId("com.google.android.apps.photos:id/next_button")
|
||||||
"android.widget.ImageView");
|
.className("android.widget.ImageView"));
|
||||||
nextButton.clickAndWaitForNewWindow();
|
|
||||||
|
if (nextButton.exists()) {
|
||||||
|
nextButton.clickAndWaitForNewWindow();
|
||||||
|
}
|
||||||
|
|
||||||
UiObject workingFolder = new UiObject(new UiSelector().text("wa-working"));
|
UiObject workingFolder = new UiObject(new UiSelector().text("wa-working"));
|
||||||
waitObject(workingFolder, viewTimeoutSecs);
|
waitObject(workingFolder, viewTimeoutSecs);
|
||||||
@ -114,7 +117,7 @@ public class UiAutomation extends UxPerfUiAutomation {
|
|||||||
Iterator<Entry<String, GestureTestParams>> it = testParams.entrySet().iterator();
|
Iterator<Entry<String, GestureTestParams>> it = testParams.entrySet().iterator();
|
||||||
|
|
||||||
// Select first photograph
|
// Select first photograph
|
||||||
selectPhoto(0);
|
selectPhoto(1);
|
||||||
|
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
Map.Entry<String, GestureTestParams> pair = it.next();
|
Map.Entry<String, GestureTestParams> pair = it.next();
|
||||||
@ -191,7 +194,7 @@ public class UiAutomation extends UxPerfUiAutomation {
|
|||||||
Iterator<Entry<String, SeekBarTestParams>> it = testParams.entrySet().iterator();
|
Iterator<Entry<String, SeekBarTestParams>> it = testParams.entrySet().iterator();
|
||||||
|
|
||||||
// Select second photograph
|
// Select second photograph
|
||||||
selectPhoto(1);
|
selectPhoto(2);
|
||||||
UiObject editView = getUiObjectByResourceId("com.google.android.apps.photos:id/edit",
|
UiObject editView = getUiObjectByResourceId("com.google.android.apps.photos:id/edit",
|
||||||
"android.widget.ImageView");
|
"android.widget.ImageView");
|
||||||
editView.click();
|
editView.click();
|
||||||
@ -252,7 +255,7 @@ public class UiAutomation extends UxPerfUiAutomation {
|
|||||||
Iterator<Entry<String, Position>> it = testParams.entrySet().iterator();
|
Iterator<Entry<String, Position>> it = testParams.entrySet().iterator();
|
||||||
|
|
||||||
// Select third photograph
|
// Select third photograph
|
||||||
selectPhoto(2);
|
selectPhoto(3);
|
||||||
UiObject editView = getUiObjectByResourceId("com.google.android.apps.photos:id/edit",
|
UiObject editView = getUiObjectByResourceId("com.google.android.apps.photos:id/edit",
|
||||||
"android.widget.ImageView");
|
"android.widget.ImageView");
|
||||||
editView.click();
|
editView.click();
|
||||||
@ -293,7 +296,7 @@ public class UiAutomation extends UxPerfUiAutomation {
|
|||||||
String[] subTests = {"anticlockwise_90", "anticlockwise_180", "anticlockwise_270"};
|
String[] subTests = {"anticlockwise_90", "anticlockwise_180", "anticlockwise_270"};
|
||||||
|
|
||||||
// Select fourth photograph
|
// Select fourth photograph
|
||||||
selectPhoto(3);
|
selectPhoto(4);
|
||||||
UiObject editView = getUiObjectByResourceId("com.google.android.apps.photos:id/edit",
|
UiObject editView = getUiObjectByResourceId("com.google.android.apps.photos:id/edit",
|
||||||
"android.widget.ImageView");
|
"android.widget.ImageView");
|
||||||
editView.click();
|
editView.click();
|
||||||
|
@ -1,13 +1,31 @@
|
|||||||
|
# Copyright 2014-2016 ARM Limited
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from wlauto import AndroidUiAutoBenchmark, Parameter, File
|
from wlauto import AndroidUiAutoBenchmark, Parameter, File
|
||||||
|
from wlauto.exceptions import DeviceError
|
||||||
|
from wlauto.exceptions import NotFoundError
|
||||||
|
|
||||||
|
__version__ = '0.1.0'
|
||||||
|
|
||||||
|
|
||||||
class Multiapp(AndroidUiAutoBenchmark):
|
class Multiapp(AndroidUiAutoBenchmark):
|
||||||
|
|
||||||
name = 'multiapp'
|
name = 'multiapp'
|
||||||
|
|
||||||
googlephotos_package = 'com.google.android.apps.photos'
|
googlephotos_package = 'com.google.android.apps.photos'
|
||||||
gmail_package = 'com.google.android.gm'
|
gmail_package = 'com.google.android.gm'
|
||||||
skype_package = 'com.skype.raider'
|
skype_package = 'com.skype.raider'
|
||||||
@ -88,8 +106,6 @@ class Multiapp(AndroidUiAutoBenchmark):
|
|||||||
'''),
|
'''),
|
||||||
]
|
]
|
||||||
|
|
||||||
file_prefix = 'wa_test_'
|
|
||||||
|
|
||||||
def __init__(self, device, **kwargs):
|
def __init__(self, device, **kwargs):
|
||||||
super(Multiapp, self).__init__(device, **kwargs)
|
super(Multiapp, self).__init__(device, **kwargs)
|
||||||
self.output_file = os.path.join(self.device.working_directory, self.instrumentation_log)
|
self.output_file = os.path.join(self.device.working_directory, self.instrumentation_log)
|
||||||
@ -106,14 +122,21 @@ class Multiapp(AndroidUiAutoBenchmark):
|
|||||||
self.uiauto_params['output_file'] = self.output_file
|
self.uiauto_params['output_file'] = self.output_file
|
||||||
|
|
||||||
def initialize(self, context):
|
def initialize(self, context):
|
||||||
|
|
||||||
super(Multiapp, self).initialize(context)
|
super(Multiapp, self).initialize(context)
|
||||||
|
|
||||||
for entry in os.listdir(self.dependencies_directory):
|
if not self.device.is_wifi_connected():
|
||||||
wa_file = ''.join([self.file_prefix, entry])
|
raise DeviceError('Wifi is not connected for device {}'.format(self.device.name))
|
||||||
if entry.endswith(".jpg"):
|
|
||||||
|
# Check for workload dependencies before proceeding
|
||||||
|
jpeg_files = [entry for entry in os.listdir(self.dependencies_directory) if entry.endswith(".jpg")]
|
||||||
|
|
||||||
|
if len(jpeg_files) < 4:
|
||||||
|
raise NotFoundError("This workload requires a minimum of four {} files in {}".format('jpg',
|
||||||
|
self.dependencies_directory))
|
||||||
|
else:
|
||||||
|
for entry in jpeg_files:
|
||||||
self.device.push_file(os.path.join(self.dependencies_directory, entry),
|
self.device.push_file(os.path.join(self.dependencies_directory, entry),
|
||||||
os.path.join(self.device.working_directory, wa_file),
|
os.path.join(self.device.working_directory, entry),
|
||||||
timeout=300)
|
timeout=300)
|
||||||
|
|
||||||
# Force a re-index of the mediaserver cache to pick up new files
|
# Force a re-index of the mediaserver cache to pick up new files
|
||||||
@ -127,14 +150,14 @@ class Multiapp(AndroidUiAutoBenchmark):
|
|||||||
# Use superclass for setup of gmail dependency
|
# Use superclass for setup of gmail dependency
|
||||||
self.version = 'Gmail'
|
self.version = 'Gmail'
|
||||||
self.package = self.gmail_package
|
self.package = self.gmail_package
|
||||||
self.logger.info('Installing dependency Gmail')
|
self.logger.info('Checking dependency Gmail')
|
||||||
super(Multiapp, self).init_resources(context)
|
super(Multiapp, self).init_resources(context)
|
||||||
super(Multiapp, self).setup(context)
|
super(Multiapp, self).setup(context)
|
||||||
|
|
||||||
# Use superclass for setup of skype dependency
|
# Use superclass for setup of skype dependency
|
||||||
self.version = 'Skype'
|
self.version = 'Skype'
|
||||||
self.package = self.skype_package
|
self.package = self.skype_package
|
||||||
self.logger.info('Installing dependency Skype')
|
self.logger.info('Checking dependency Skype')
|
||||||
super(Multiapp, self).init_resources(context)
|
super(Multiapp, self).init_resources(context)
|
||||||
super(Multiapp, self).setup(context)
|
super(Multiapp, self).setup(context)
|
||||||
|
|
||||||
@ -175,17 +198,17 @@ class Multiapp(AndroidUiAutoBenchmark):
|
|||||||
# Restore default package
|
# Restore default package
|
||||||
self.package = self.googlephotos_package
|
self.package = self.googlephotos_package
|
||||||
|
|
||||||
for file in self.device.listdir(self.device.working_directory):
|
for entry in self.device.listdir(self.device.working_directory):
|
||||||
if file.endswith(".log"):
|
if entry.endswith(".log"):
|
||||||
self.device.pull_file(os.path.join(self.device.working_directory, file), context.output_directory)
|
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, file))
|
self.device.delete_file(os.path.join(self.device.working_directory, entry))
|
||||||
|
|
||||||
def finalize(self, context):
|
def finalize(self, context):
|
||||||
super(Multiapp, self).finalize(context)
|
super(Multiapp, self).finalize(context)
|
||||||
|
|
||||||
for entry in self.device.listdir(self.device.working_directory):
|
for entry in self.device.listdir(self.device.working_directory):
|
||||||
if entry.startswith(self.file_prefix) and entry.endswith(".jpg"):
|
if entry.endswith(".jpg"):
|
||||||
self.device.delete_file(os.path.join(self.device.working_directory, entry))
|
self.device.delete_file(os.path.join(self.device.working_directory, entry))
|
||||||
|
|
||||||
# Force a re-index of the mediaserver cache to removed cached files
|
# Force a re-index of the mediaserver cache to remove cached files
|
||||||
self.device.execute('am broadcast -a android.intent.action.MEDIA_MOUNTED -d file:///sdcard')
|
self.device.execute('am broadcast -a android.intent.action.MEDIA_MOUNTED -d file:///sdcard')
|
||||||
|
Binary file not shown.
@ -26,12 +26,14 @@ public class UiAutomation extends UxPerfUiAutomation {
|
|||||||
com.arm.wlauto.uiauto.googlephotos.UiAutomation googlephotos =
|
com.arm.wlauto.uiauto.googlephotos.UiAutomation googlephotos =
|
||||||
new com.arm.wlauto.uiauto.googlephotos.UiAutomation();
|
new com.arm.wlauto.uiauto.googlephotos.UiAutomation();
|
||||||
|
|
||||||
|
googlephotos.pauseForSplashScreen();
|
||||||
|
setScreenOrientation(ScreenOrientation.NATURAL);
|
||||||
confirmAccess();
|
confirmAccess();
|
||||||
googlephotos.dismissWelcomeView();
|
googlephotos.dismissWelcomeView();
|
||||||
googlephotos.selectWorkingGallery();
|
googlephotos.selectWorkingGallery();
|
||||||
|
|
||||||
// select the first photo
|
// select the first photo
|
||||||
googlephotos.tagPhoto(0);
|
googlephotos.tagPhoto(1);
|
||||||
sendToGmail();
|
sendToGmail();
|
||||||
|
|
||||||
// select the second photo
|
// select the second photo
|
||||||
@ -42,7 +44,7 @@ public class UiAutomation extends UxPerfUiAutomation {
|
|||||||
// once more from googlephotos
|
// once more from googlephotos
|
||||||
pressBack();
|
pressBack();
|
||||||
pressBack();
|
pressBack();
|
||||||
googlephotos.tagPhoto(1);
|
googlephotos.tagPhoto(2);
|
||||||
|
|
||||||
sendToSkype();
|
sendToSkype();
|
||||||
|
|
||||||
|
Binary file not shown.
@ -136,7 +136,7 @@ public class UiAutomation extends UxPerfUiAutomation {
|
|||||||
peopleItem.waitForExists(timeout);
|
peopleItem.waitForExists(timeout);
|
||||||
peopleItem.click();
|
peopleItem.click();
|
||||||
UiObject confirm =
|
UiObject confirm =
|
||||||
getUiObjectByResourceId("com.skype.raider:id/fab", "android.widget.ImageView");
|
new UiObject(new UiSelector().resourceId("com.skype.raider:id/fab"));
|
||||||
confirm.click();
|
confirm.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user