diff --git a/wlauto/common/android/workload.py b/wlauto/common/android/workload.py index 0dbae5bd..34bb8059 100644 --- a/wlauto/common/android/workload.py +++ b/wlauto/common/android/workload.py @@ -138,6 +138,11 @@ class ApkWorkload(Workload): :view: The class of the main view pane of the app. This needs to be defined in order to collect SurfaceFlinger-derived statistics (such as FPS) for the app, but may otherwise be left as ``None``. + :launch_main: If ``False``, the default activity will not be launched (during setup), + allowing workloads to start the app with an intent of their choice in + the run step. This is useful for apps without a launchable default/main + activity or those where it cannot be launched without intent data (which + is provided at the run phase). :install_timeout: Timeout for the installation of the APK. This may vary wildly based on the size and nature of a specific APK, and so should be defined on per-workload basis. @@ -160,6 +165,7 @@ class ApkWorkload(Workload): min_apk_version = None max_apk_version = None supported_platforms = ['android'] + launch_main = True parameters = [ Parameter('install_timeout', kind=int, default=300, @@ -214,7 +220,8 @@ class ApkWorkload(Workload): if self.check_apk: self.check_apk_version() - self.launch_package() + if self.launch_main: + self.launch_package() # launch default activity without intent data self.device.execute('am kill-all') # kill all *background* activities self.device.clear_logcat() diff --git a/wlauto/workloads/skype/__init__.py b/wlauto/workloads/skype/__init__.py new file mode 100755 index 00000000..f84c8ec8 --- /dev/null +++ b/wlauto/workloads/skype/__init__.py @@ -0,0 +1,99 @@ +# 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 time +from wlauto import AndroidUxPerfWorkload, Parameter + + +class Skype(AndroidUxPerfWorkload): + + name = 'skype' + description = ''' + A workload to perform standard productivity tasks within Skype. The + workload logs in to the Skype application, selects a recipient from the + contacts list and then initiates either a voice or video call. + + Test description: + + 1. Open Skype application + 2. Log in to a pre-defined account + 3. Select a recipient from the Contacts list + 4. Initiate either a ``voice`` or ``video`` call for ``duration`` time (in seconds) + + **Skype Setup** + + - You should install Skype client from Google Play Store on the device + (this was tested with client version 7.01.0.669; other recent versions + should also work). + - You must have a Skype account set up. + - The contact to be called must be added (and has accepted) to the + account. It's possible to have multiple contacts in the list, however + the contact to be called *must* be visible on initial navigation to the + list. + - For video calls the contact must be able to received the call. This + means that there must be a Skype client running (somewhere) with the + contact logged in and that client must have been configured to + auto-accept calls from the account on the device (how to set this + varies between different versions of Skype and between platforms -- + please search online for specific instructions). + https://support.skype.com/en/faq/FA3751/can-i-automatically-answer-all-my-calls-with-video-in-skype-for-windows-desktop + ''' + package = 'com.skype.raider' + min_apk_version = '7.01.0.669' + view = [package + '/com.skype.android.app.calling.CallActivity', + package + '/com.skype.android.app.calling.PreCallActivity', + package + '/com.skype.android.app.chat.ChatActivity', + package + '/com.skype.android.app.main.HubActivity', + package + '/com.skype.android.app.main.SplashActivity', + package + '/com.skype.android.app.signin.SignInActivity', + package + '/com.skype.android.app.signin.UnifiedLandingPageActivity'] + + activity = '' # Skype has no default 'main' activity + launch_main = False # overrides extended class + + parameters = [ + Parameter('login_name', kind=str, mandatory=True, + description=''' + Account to use when logging into the device from which the call will be made + '''), + Parameter('login_pass', kind=str, mandatory=True, + description='Password associated with the account to log into the device'), + Parameter('contact_name', kind=str, mandatory=True, default='Echo / Sound Test Service', + description='This is the contact display name as it appears in the people list'), + Parameter('duration', kind=int, default=10, + description='This is the duration of the call in seconds'), + Parameter('action', kind=str, allowed_values=['voice', 'video'], default='voice', + description='Action to take - either voice call (default) or video'), + ] + + # This workload relies on the internet so check that there is a working + # internet connection + requires_network = True + + def __init__(self, device, **kwargs): + super(Skype, self).__init__(device, **kwargs) + self.run_timeout = self.duration + 240 + + def validate(self): + super(Skype, self).validate() + self.uiauto_params['my_id'] = self.login_name + self.uiauto_params['my_pwd'] = self.login_pass + self.uiauto_params['name'] = self.contact_name.replace(' ', '0space0') + self.uiauto_params['duration'] = self.duration + self.uiauto_params['action'] = self.action + + def setup(self, context): + super(Skype, self).setup(context) + self.device.execute('am start -W -a android.intent.action.VIEW -d skype:dummy?dummy') diff --git a/wlauto/workloads/skype/com.arm.wlauto.uiauto.skype.jar b/wlauto/workloads/skype/com.arm.wlauto.uiauto.skype.jar new file mode 100644 index 00000000..44f99436 Binary files /dev/null and b/wlauto/workloads/skype/com.arm.wlauto.uiauto.skype.jar differ diff --git a/wlauto/workloads/skype/uiauto/build.sh b/wlauto/workloads/skype/uiauto/build.sh new file mode 100755 index 00000000..d9673df8 --- /dev/null +++ b/wlauto/workloads/skype/uiauto/build.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +# CD into build dir if possible - allows building from any directory +script_path='.' +if `readlink -f $0 &>/dev/null`; then + script_path=`readlink -f $0 2>/dev/null` +fi +script_dir=`dirname $script_path` +cd $script_dir + +# Ensure build.xml exists before starting +if [[ ! -f build.xml ]]; then + echo 'Ant build.xml file not found! Check that you are in the right directory.' + exit 9 +fi + +# Copy base classes from wlauto dist +class_dir=bin/classes/com/arm/wlauto/uiauto +base_classes=`python -c "import os, wlauto; print os.path.join(os.path.dirname(wlauto.__file__), 'common', 'android', '*.class')"` +mkdir -p $class_dir +cp $base_classes $class_dir + +# Build and return appropriate exit code if failed +ant build +exit_code=$? +if [[ $exit_code -ne 0 ]]; then + echo "ERROR: 'ant build' exited with code $exit_code" + exit $exit_code +fi + +# If successful move JAR file to workload folder (overwrite previous) +package=com.arm.wlauto.uiauto.skype.jar +rm -f ../$package +if [[ -f bin/$package ]]; then + cp bin/$package .. +else + echo 'ERROR: UiAutomator JAR could not be found!' + exit 9 +fi diff --git a/wlauto/workloads/skypevideo/uiauto/build.xml b/wlauto/workloads/skype/uiauto/build.xml similarity index 98% rename from wlauto/workloads/skypevideo/uiauto/build.xml rename to wlauto/workloads/skype/uiauto/build.xml index c2fdeb90..dd54c056 100644 --- a/wlauto/workloads/skypevideo/uiauto/build.xml +++ b/wlauto/workloads/skype/uiauto/build.xml @@ -1,5 +1,5 @@ - +