1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2024-10-05 18:31:12 +01:00

GoogleSlides: Ported workload from WA2

This commit is contained in:
Marc Bonnici 2017-11-13 12:08:38 +00:00 committed by setrofim
parent 1f5a34b9a8
commit 612646606d
12 changed files with 995 additions and 0 deletions

View File

@ -0,0 +1,123 @@
# 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
from wa import ApkUiautoWorkload, Parameter
from wa.framework.exception import ValidationError
class GoogleSlides(ApkUiautoWorkload):
name = 'googleslides'
package_names = ['com.google.android.apps.docs.editors.slides']
description = '''
A workload to perform standard productivity tasks with Google Slides. The workload carries
out various tasks, such as creating a new presentation, adding text, images, and shapes,
as well as basic editing and playing a slideshow.
This workload should be able to run without a network connection.
There are two main scenarios:
1. create test: a presentation is created in-app and some editing done on it,
2. load test: a pre-existing PowerPoint file is copied onto the device for testing.
--- create ---
Create a new file in the application and perform basic editing on it. This test also
requires an image file specified by the param ``test_image`` to be copied onto the device.
Test description:
1. Start the app and skip the welcome screen. Dismiss the work offline banner if present.
2. Go to the app settings page and enables PowerPoint compatibility mode. This allows
PowerPoint files to be created inside Google Slides.
3. Create a new PowerPoint presentation in the app (PPT compatibility mode) with a title
slide and save it to device storage.
4. Insert another slide and to it insert the pushed image by picking it from the gallery.
5. Insert a final slide and add a shape to it. Resize and drag the shape to modify it.
6. Finally, navigate back to the documents list.
--- load ---
Copy a PowerPoint presentation onto the device to test slide navigation. The PowerPoint
file to be copied is given by ``test_file``.
Test description:
1. From the documents list (following the create test), open the specified PowerPoint
by navigating into device storage and wait for it to be loaded.
2. A navigation test is performed while the file is in editing mode (i.e. not slideshow).
swiping forward to the next slide until ``slide_count`` swipes are performed.
3. While still in editing mode, the same action is done in the reverse direction back to
the first slide.
4. Enter presentation mode by selecting to play the slideshow.
5. Swipe forward to play the slideshow, for a maximum number of ``slide_count`` swipes.
6. Finally, repeat the previous step in the reverse direction while still in presentation
mode, navigating back to the first slide.
NOTE: There are known issues with the reliability of this workload on some targets.
It MAY NOT ALWAYS WORK on your device. If you do run into problems, it might help to
set ``do_text_entry`` parameter to ``False``.
Known working APK version: 1.7.032.06
'''
parameters = [
Parameter('test_image', kind=str, default='uxperf_1600x1200.jpg',
description='''
An image to be copied onto the device that will be embedded in the
PowerPoint file as part of the test.
'''),
Parameter('test_file', kind=str, default='uxperf_test_doc.pptx',
description='''
If specified, the workload will copy the PowerPoint file to be used for
testing onto the device. Otherwise, a file will be created inside the app.
'''),
Parameter('slide_count', kind=int, default=5,
description='''
Number of slides in aforementioned local file. Determines number of
swipe actions when playing slide show.
'''),
Parameter('do_text_entry', kind=bool, default=True,
description='''
If set to ``True``, will attempt to enter text in the first slide as part
of the test. Currently seems to be problematic on some devices, most
notably Samsung devices.
''')
]
# Created file will be saved with this name
new_doc_name = "WORKLOAD AUTOMATION"
def __init__(self, target, **kwargs):
super(GoogleSlides, self).__init__(target, **kwargs)
self.run_timeout = 600
self.deployable_assets = [self.test_image, self.test_file]
def init_resources(self, context):
super(GoogleSlides, self).init_resources(context)
# 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['test_file'] = self.test_file
self.gui.uiauto_params['slide_count'] = self.slide_count
self.gui.uiauto_params['do_text_entry'] = self.do_text_entry
self.gui.uiauto_params['new_doc_name'] = self.new_doc_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))
# Only accept certain presentation formats
if os.path.splitext(self.test_file.lower())[1] not in ['.pptx']:
raise ValidationError('{} must be a PPTX file'.format(self.test_file))

View File

@ -0,0 +1,36 @@
apply plugin: 'com.android.application'
def packageName = "com.arm.wa.uiauto.googleslides"
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "${packageName}"
minSdkVersion 18
targetSdkVersion 25
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
applicationVariants.all { variant ->
variant.outputs.each { output ->
output.outputFile = file("$project.buildDir/apk/${packageName}.apk")
}
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support.test:runner:0.5'
compile 'com.android.support.test:rules:0.5'
// Using older version of uitautomator as the latest version can't find canvas elements.
compile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.1'
compile(name: 'uiauto', ext:'aar')
}
repositories {
flatDir {
dirs 'libs'
}
}

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.arm.wa.uiauto.googleslides"
android:versionCode="1"
android:versionName="1.0">
<instrumentation
android:name="android.support.test.runner.AndroidJUnitRunner"
android:targetPackage="${applicationId}"/>
</manifest>

View File

@ -0,0 +1,504 @@
/* 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.
*/
package com.arm.wa.uiauto.googleslides;
import android.graphics.Rect;
import android.os.Bundle;
import android.os.SystemClock;
import android.support.test.runner.AndroidJUnit4;
import android.support.test.uiautomator.Configurator;
import android.support.test.uiautomator.UiObject;
import android.support.test.uiautomator.UiObject2;
import android.support.test.uiautomator.UiScrollable;
import android.support.test.uiautomator.UiSelector;
import android.support.test.uiautomator.By;
import com.arm.wa.uiauto.BaseUiAutomation;
import com.arm.wa.uiauto.UxPerfUiAutomation;
import com.arm.wa.uiauto.ActionLogger;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import static com.arm.wa.uiauto.BaseUiAutomation.FindByCriteria.BY_DESC;
import static com.arm.wa.uiauto.BaseUiAutomation.FindByCriteria.BY_ID;
import static com.arm.wa.uiauto.BaseUiAutomation.FindByCriteria.BY_TEXT;
@RunWith(AndroidJUnit4.class)
public class UiAutomation extends BaseUiAutomation {
protected Bundle parameters;
protected String packageName;
protected String packageID;
protected String newDocumentName;
protected String pushedDocumentName;
protected int slideCount;
protected boolean doTextEntry;
protected String workingDirectoryName;
public static final int WAIT_TIMEOUT_1SEC = 1000;
public static final int SLIDE_WAIT_TIME_MS = 200;
public static final int DEFAULT_SWIPE_STEPS = 10;
@Before
public void initialize() {
parameters = getParams();
packageID = getPackageID(parameters);
newDocumentName = parameters.getString("new_doc_name");
pushedDocumentName = parameters.getString("test_file");
slideCount = parameters.getInt("slide_count");
doTextEntry = parameters.getBoolean("do_text_entry");
workingDirectoryName = parameters.getString("workdir_name");
}
@Test
public void setup() throws Exception {
setScreenOrientation(ScreenOrientation.NATURAL);
changeAckTimeout(100);
skipWelcomeScreen();
sleep(1);
dismissUpdateDialog();
sleep(1);
dismissWorkOfflineBanner();
sleep(1);
enablePowerpointCompat();
sleep(1);
testEditNewSlidesDocument(newDocumentName, workingDirectoryName, doTextEntry);
}
@Test
public void runWorkload() throws Exception {
openDocument(pushedDocumentName, workingDirectoryName);
waitForProgress(WAIT_TIMEOUT_1SEC*30);
testSlideshowFromStorage(slideCount);
}
@Test
public void teardown() throws Exception {
unsetScreenOrientation();
}
public void dismissWorkOfflineBanner() throws Exception {
UiObject banner =
mDevice.findObject(new UiSelector().textContains("Work offline"));
if (banner.waitForExists(WAIT_TIMEOUT_1SEC)) {
clickUiObject(BY_TEXT, "Got it", "android.widget.Button");
}
}
public void dismissUpdateDialog() throws Exception {
UiObject update =
mDevice.findObject(new UiSelector().textContains("App update recommended"));
if (update.waitForExists(WAIT_TIMEOUT_1SEC)) {
clickUiObject(BY_TEXT, "Dismiss");
}
}
public void enterTextInSlide(String viewName, String textToEnter) throws Exception {
UiObject view =
mDevice.findObject(new UiSelector().resourceId(packageID + "main_canvas")
.childSelector(new UiSelector()
.descriptionMatches(viewName)));
view.click();
mDevice.pressEnter();
view.legacySetText(textToEnter);
tapOpenArea();
// On some devices, keyboard pops up when entering text, and takes a noticeable
// amount of time (few milliseconds) to disappear after clicking Done.
// In these cases, trying to find a view immediately after entering text leads
// to an exception, so a short wait-time is added for stability.
SystemClock.sleep(SLIDE_WAIT_TIME_MS);
}
public void insertSlide(String slideLayout) throws Exception {
clickUiObject(BY_DESC, "Add slide", true);
clickUiObject(BY_TEXT, slideLayout, true);
}
public void insertImage(String workingDirectoryName) throws Exception {
UiObject insertButton = mDevice.findObject(new UiSelector().descriptionContains("Insert"));
if (insertButton.exists()) {
insertButton.click();
} else {
clickUiObject(BY_DESC, "More options");
clickUiObject(BY_TEXT, "Insert");
}
clickUiObject(BY_TEXT, "Image", true);
clickUiObject(BY_TEXT, "From photos");
UiObject imagesFolder = mDevice.findObject(new UiSelector().className("android.widget.TextView").textContains("Images"));
UiObject moreOptions = mDevice.findObject(new UiSelector().description("More Options"));
// On some devices the images tabs is missing so we need select the local storage.
UiObject localDevice = mDevice.findObject(new UiSelector().textMatches(".*[GM]B free"));
if (!imagesFolder.waitForExists(WAIT_TIMEOUT_1SEC*10)) {
clickUiObject(BY_DESC, "Show roots");
}
if (imagesFolder.exists()) {
imagesFolder.click();
} else if (moreOptions.exists()){
// The local storage can hidden by default so we need to enable showing it.
moreOptions.click();
moreOptions.click();
clickUiObject(BY_TEXT, "Show internal storage");
clickUiObject(BY_DESC, "Show roots");
} else if (localDevice.exists()){
localDevice.click();
}
UiObject folderEntry = mDevice.findObject(new UiSelector().textContains(workingDirectoryName));
UiScrollable list = new UiScrollable(new UiSelector().scrollable(true));
if (!folderEntry.exists() && list.waitForExists(WAIT_TIMEOUT_1SEC)) {
list.scrollIntoView(folderEntry);
} else {
folderEntry.waitForExists(WAIT_TIMEOUT_1SEC*10);
}
folderEntry.clickAndWaitForNewWindow();
UiObject picture = mDevice.findObject(new UiSelector().resourceId("com.android.documentsui:id/date").enabled(true));
picture.click();
}
public void insertShape(String shapeName) throws Exception {
String testTag = "shape_insert";
ActionLogger logger = new ActionLogger(testTag, parameters);
UiObject insertButton =
mDevice.findObject(new UiSelector().descriptionContains("Insert"));
logger.start();
if (insertButton.exists()) {
insertButton.click();
} else {
clickUiObject(BY_DESC, "More options");
clickUiObject(BY_TEXT, "Insert");
}
clickUiObject(BY_TEXT, "Shape");
clickUiObject(BY_DESC, shapeName);
logger.stop();
}
public void modifyShape(String shapeName) throws Exception {
String testTag = "shape_resize";
ActionLogger logger = new ActionLogger(testTag, parameters);
UiObject resizeHandle =
mDevice.findObject(new UiSelector().descriptionMatches(".*Bottom[- ]right resize.*"));
Rect bounds = resizeHandle.getVisibleBounds();
int newX = bounds.left - 40;
int newY = bounds.bottom - 40;
logger.start();
resizeHandle.dragTo(newX, newY, 40);
logger.stop();
testTag = "shape_drag";
logger = new ActionLogger(testTag, parameters);
UiObject shapeSelector =
mDevice.findObject(new UiSelector().resourceId(packageID + "main_canvas")
.childSelector(new UiSelector()
.descriptionContains(shapeName)));
logger.start();
shapeSelector.dragTo(newX, newY, 40);
logger.stop();
}
public void openDocument(String docName, String workingDirectoryName) throws Exception {
String testTag = "document_open";
ActionLogger logger = new ActionLogger(testTag, parameters);
clickUiObject(BY_DESC, "Open presentation");
clickUiObject(BY_TEXT, "Device storage", true);
clickUiObject(BY_DESC, "Navigate up");
UiScrollable list =
new UiScrollable(new UiSelector().className("android.widget.ListView"));
list.scrollIntoView(new UiSelector().textMatches(workingDirectoryName));
clickUiObject(BY_TEXT, workingDirectoryName);
list.scrollIntoView(new UiSelector().textContains(docName));
logger.start();
clickUiObject(BY_TEXT, docName);
clickUiObject(BY_TEXT, "Open", "android.widget.Button", true);
logger.stop();
}
public void newDocument() throws Exception {
String testTag = "document_new";
ActionLogger logger = new ActionLogger(testTag, parameters);
logger.start();
clickUiObject(BY_DESC, "New presentation");
clickUiObject(BY_TEXT, "New PowerPoint", true);
logger.stop();
dismissUpdateDialog();
}
public void saveDocument(String docName) throws Exception {
String testTag = "document_save";
ActionLogger logger = new ActionLogger(testTag, parameters);
UiObject saveActionButton =
mDevice.findObject(new UiSelector().textMatches("save|SAVE"));
UiObject unsavedIndicator =
mDevice.findObject(new UiSelector().textContains("Unsaved changes"));
logger.start();
if (saveActionButton.waitForExists(WAIT_TIMEOUT_1SEC)) {
saveActionButton.click();
} else if (unsavedIndicator.waitForExists(WAIT_TIMEOUT_1SEC)) {
unsavedIndicator.click();
}
clickUiObject(BY_TEXT, "Device");
UiObject save = clickUiObject(BY_TEXT, "Save", "android.widget.Button");
if (save.waitForExists(WAIT_TIMEOUT_1SEC)) {
save.click();
}
logger.stop();
// Overwrite if prompted
// Should not happen under normal circumstances. But ensures test doesn't stop
// if a previous iteration failed prematurely and was unable to delete the file.
// Note that this file isn't removed during workload teardown as deleting it is
// part of the UiAutomator test case.
UiObject overwriteView =
mDevice.findObject(new UiSelector().textContains("already exists"));
if (overwriteView.waitForExists(WAIT_TIMEOUT_1SEC)) {
clickUiObject(BY_TEXT, "Overwrite");
}
}
public void deleteDocument(String docName) throws Exception {
String testTag = "document_delete";
ActionLogger logger = new ActionLogger(testTag, parameters);
String filenameRegex = String.format(".*((%s)|([Uu]ntitled presentation)).pptx.*", docName);
UiObject doc =
mDevice.findObject(new UiSelector().textMatches(filenameRegex));
UiObject moreActions =
doc.getFromParent(new UiSelector().descriptionContains("More actions"));
logger.start();
moreActions.click();
UiObject deleteButton =
mDevice.findObject(new UiSelector().textMatches(".*([Dd]elete|[Rr]emove).*"));
if (deleteButton.waitForExists(WAIT_TIMEOUT_1SEC)) {
deleteButton.click();
} else {
// Delete button not found, try to scroll the view
UiScrollable scrollable =
new UiScrollable(new UiSelector().scrollable(true)
.childSelector(new UiSelector()
.textContains("Add people")));
if (scrollable.exists()) {
scrollable.scrollIntoView(deleteButton);
} else {
UiObject content =
mDevice.findObject(new UiSelector().resourceId(packageID + "content"));
int attemptsLeft = 10; // try a maximum of 10 swipe attempts
while (!deleteButton.exists() && attemptsLeft > 0) {
content.swipeUp(DEFAULT_SWIPE_STEPS);
attemptsLeft--;
}
}
deleteButton.click();
}
UiObject delete =
mDevice.findObject(new UiSelector().textMatches("DELETE|[Dd]elete"));
if (delete.exists()){
delete.click();
}
delete = mDevice.findObject(new UiSelector().textMatches("MOVE TO BIN"));
if (delete.exists()){
delete.click();
}
logger.stop();
}
protected void skipWelcomeScreen() throws Exception {
UiObject skip =
mDevice.findObject(new UiSelector().textMatches("Skip"));
if (skip.exists()) {
skip.click();
}
}
protected void enablePowerpointCompat() throws Exception {
String testTag = "enable_pptmode";
ActionLogger logger = new ActionLogger(testTag, parameters);
logger.start();
// Work around to open navigation drawer via swipe.
uiDeviceSwipeHorizontal(0, getDisplayCentreWidth(), getDisplayCentreHeight() / 2, 10);
clickUiObject(BY_TEXT, "Settings");
clickUiObject(BY_TEXT, "Create PowerPoint");
mDevice.pressBack();
logger.stop();
}
protected void testEditNewSlidesDocument(String docName, String workingDirectoryName, boolean doTextEntry) throws Exception {
// Init
newDocument();
waitForProgress(WAIT_TIMEOUT_1SEC * 30);
// Slide 1 - Text
if (doTextEntry) {
enterTextInSlide(".*[Tt]itle.*", docName);
windowApplication();
// Save
saveDocument(docName);
sleep(1);
}
// Slide 2 - Image
insertSlide("Title only");
insertImage(workingDirectoryName);
sleep(1);
// If text wasn't entered in first slide, save prompt will appear here
if (!doTextEntry) {
// Save
saveDocument(docName);
sleep(1);
}
// Slide 3 - Shape
insertSlide("Title slide");
String shapeName = "Rounded rectangle";
insertShape(shapeName);
modifyShape(shapeName);
mDevice.pressBack();
mDevice.pressBack();
sleep(1);
// Tidy up
dismissWorkOfflineBanner(); // if it appears on the homescreen
// Note: Currently disabled because it fails on Samsung devices
deleteDocument(docName);
}
protected void testSlideshowFromStorage(int slideCount) throws Exception {
String testTag = "slideshow";
// Begin Slide show test
// Note: Using coordinates slightly offset from the slide edges avoids accidentally
// selecting any shapes or text boxes inside the slides while swiping, which may
// cause the view to switch into edit mode and fail the test
UiObject slideCanvas =
mDevice.findObject(new UiSelector().resourceId(packageID + "main_canvas"));
Rect canvasBounds = slideCanvas.getVisibleBounds();
int leftEdge = canvasBounds.left + 10;
int rightEdge = canvasBounds.right - 10;
int yCoordinate = canvasBounds.top + 5;
int slideIndex = 0;
// scroll forward in edit mode
ActionLogger logger = new ActionLogger(testTag + "_editforward", parameters);
logger.start();
while (slideIndex++ < slideCount) {
uiDeviceSwipeHorizontal(rightEdge, leftEdge, yCoordinate, DEFAULT_SWIPE_STEPS);
waitForProgress(WAIT_TIMEOUT_1SEC*5);
}
logger.stop();
sleep(1);
// scroll backward in edit mode
logger = new ActionLogger(testTag + "_editbackward", parameters);
logger.start();
while (slideIndex-- > 0) {
uiDeviceSwipeHorizontal(leftEdge, rightEdge, yCoordinate, DEFAULT_SWIPE_STEPS);
waitForProgress(WAIT_TIMEOUT_1SEC*5);
}
logger.stop();
sleep(1);
// run slideshow
logger = new ActionLogger(testTag + "_run", parameters);
logger.start();
clickUiObject(BY_DESC, "Start slideshow", true);
UiObject onDevice =
mDevice.findObject(new UiSelector().textContains("this device"));
if (onDevice.waitForExists(WAIT_TIMEOUT_1SEC)) {
onDevice.clickAndWaitForNewWindow();
waitForProgress(WAIT_TIMEOUT_1SEC*30);
UiObject presentation =
mDevice.findObject(new UiSelector().descriptionContains("Presentation Viewer"));
presentation.waitForExists(WAIT_TIMEOUT_1SEC*30);
}
logger.stop();
sleep(1);
slideIndex = 0;
// scroll forward in slideshow mode
logger = new ActionLogger(testTag + "_playforward", parameters);
logger.start();
while (slideIndex++ < slideCount) {
uiDeviceSwipeHorizontal(rightEdge, leftEdge, yCoordinate, DEFAULT_SWIPE_STEPS);
waitForProgress(WAIT_TIMEOUT_1SEC*5);
}
logger.stop();
sleep(1);
// scroll backward in slideshow mode
logger = new ActionLogger(testTag + "_playbackward", parameters);
logger.start();
while (slideIndex-- > 0) {
uiDeviceSwipeHorizontal(leftEdge, rightEdge, yCoordinate, DEFAULT_SWIPE_STEPS);
waitForProgress(WAIT_TIMEOUT_1SEC*5);
}
logger.stop();
sleep(1);
mDevice.pressBack();
mDevice.pressBack();
}
protected boolean waitForProgress(int timeout) throws Exception {
UiObject progress = mDevice.findObject(new UiSelector().className("android.widget.ProgressBar"));
if (progress.waitForExists(WAIT_TIMEOUT_1SEC)) {
return progress.waitUntilGone(timeout);
} else {
return false;
}
}
private long changeAckTimeout(long newTimeout) {
Configurator config = Configurator.getInstance();
long oldTimeout = config.getActionAcknowledgmentTimeout();
config.setActionAcknowledgmentTimeout(newTimeout);
return oldTimeout;
}
private void tapOpenArea() throws Exception {
UiObject openArea = getUiObjectByResourceId(packageID + "punch_view_pager");
Rect bounds = openArea.getVisibleBounds();
// 10px from top of view, 10px from the right edge
tapDisplay(bounds.right - 10, bounds.top + 10);
}
public void windowApplication() throws Exception {
UiObject window =
mDevice.findObject(new UiSelector().resourceId("android:id/restore_window"));
if (window.waitForExists(WAIT_TIMEOUT_1SEC)){
window.click();
}
}
}

View File

@ -0,0 +1,23 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

View File

@ -0,0 +1,40 @@
#!/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 gradelw exists before starting
if [[ ! -f gradlew ]]; then
echo 'gradlew file not found! Check that you are in the right directory.'
exit 9
fi
# Copy base classes from wa dist
libs_dir=app/libs
base_class=`python -c "import os, wa; print os.path.join(os.path.dirname(wa.__file__), 'framework', 'uiauto', 'uiauto.aar')"`
mkdir -p $libs_dir
cp $base_class $libs_dir
# Build and return appropriate exit code if failed
# ant build
./gradlew clean :app:assembleDebug
exit_code=$?
if [[ $exit_code -ne 0 ]]; then
echo "ERROR: 'gradle build' exited with code $exit_code"
exit $exit_code
fi
# If successful move APK file to workload folder (overwrite previous)
package=com.arm.wa.uiauto.googleslides
rm -f ../$package
if [[ -f app/build/apk/$package.apk ]]; then
cp app/build/apk/$package.apk ../$package.apk
else
echo 'ERROR: UiAutomator apk could not be found!'
exit 9
fi

Binary file not shown.

View File

@ -0,0 +1,6 @@
#Wed May 03 15:42:44 BST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip

160
wa/workloads/googleslides/uiauto/gradlew vendored Executable file
View File

@ -0,0 +1,160 @@
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

View File

@ -0,0 +1,90 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@ -0,0 +1 @@
include ':app'