Repository: cordova-paramedic
Updated Branches:
  refs/heads/master fbd7ddaf2 -> 3ef549a3b


Support for various apk names when running on SauceLabs


Project: http://git-wip-us.apache.org/repos/asf/cordova-paramedic/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-paramedic/commit/3ef549a3
Tree: http://git-wip-us.apache.org/repos/asf/cordova-paramedic/tree/3ef549a3
Diff: http://git-wip-us.apache.org/repos/asf/cordova-paramedic/diff/3ef549a3

Branch: refs/heads/master
Commit: 3ef549a3bffa05c0944af7bd2debbbbb49694867
Parents: fbd7dda
Author: Alexander Sorokin <alexander.soro...@akvelon.com>
Authored: Fri Sep 16 17:54:42 2016 +0300
Committer: Alexander Sorokin <alexander.soro...@akvelon.com>
Committed: Fri Sep 16 17:54:42 2016 +0300

----------------------------------------------------------------------
 lib/appium/helpers/wdHelper.js |  5 +----
 lib/paramedic.js               | 22 ++++++++++++++++++----
 2 files changed, 19 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-paramedic/blob/3ef549a3/lib/appium/helpers/wdHelper.js
----------------------------------------------------------------------
diff --git a/lib/appium/helpers/wdHelper.js b/lib/appium/helpers/wdHelper.js
index b1c82fc..6902970 100644
--- a/lib/appium/helpers/wdHelper.js
+++ b/lib/appium/helpers/wdHelper.js
@@ -118,10 +118,7 @@ module.exports.getWebviewContext = function (driver, 
retries) {
                 .then(function () {
                     if (retries > 0) {
                         console.log('No webview context. Retries remaining: ' 
+ retries);
-                        return driver
-                            .then(function () {
-                                return 
module.exports.getWebviewContext(driver, retries - 1);
-                        });
+                        return module.exports.getWebviewContext(driver, 
retries - 1);
                     }
                     throw 'Couldn\'t get webview context.';
                 });

http://git-wip-us.apache.org/repos/asf/cordova-paramedic/blob/3ef549a3/lib/paramedic.js
----------------------------------------------------------------------
diff --git a/lib/paramedic.js b/lib/paramedic.js
index e8ce333..a8ee0ce 100644
--- a/lib/paramedic.js
+++ b/lib/paramedic.js
@@ -554,14 +554,14 @@ ParamedicRunner.prototype.getPackageName = function () {
     return packageName;
 };
 
-ParamedicRunner.prototype.getBinaryPath = function () {
+ParamedicRunner.prototype.getBinaryDir = function () {
     var binaryPath;
     switch (this.config.getPlatformId()) {
         case 'android':
-            binaryPath = path.join(this.tempFolder.name, 
'platforms/android/build/outputs/apk', this.getBinaryName());
+            binaryPath = path.join(this.tempFolder.name, 
'platforms/android/build/outputs/apk');
             break;
         case 'ios':
-            binaryPath = path.join(this.tempFolder.name, 
'platforms/ios/build/emulator/', this.getBinaryName());
+            binaryPath = path.join(this.tempFolder.name, 
'platforms/ios/build/emulator/');
             break;
         default:
             throw new Error('Unsupported platform for sauce labs testing: ' + 
this.config.getPlatformId());
@@ -573,7 +573,21 @@ ParamedicRunner.prototype.getBinaryName = function () {
     var binaryName;
     switch (this.config.getPlatformId()) {
         case 'android':
-            binaryName = 'android-debug.apk';
+            shell.pushd(this.getBinaryDir());
+            var apks = shell.ls('android*debug.apk');
+            if (apks.length > 0) {
+                binaryName = apks.reduce(function (previous, current) {
+                    // if there is any apk for x86, take it
+                    if (current.indexOf('x86') >= 0) {
+                        return current;
+                    }
+                    // if not, just take the first one
+                    return previous;
+                });
+            } else {
+                throw new Error('Couldn\'t locate built apk');
+            }
+            shell.popd();
             break;
         case 'ios':
             binaryName = 'HelloCordova.app';


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cordova.apache.org
For additional commands, e-mail: commits-h...@cordova.apache.org

Reply via email to