You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ja...@apache.org on 2018/11/30 12:55:58 UTC

[cordova-paramedic] branch janpio-misc updated (d7fb517 -> 251aa29)

This is an automated email from the ASF dual-hosted git repository.

janpio pushed a change to branch janpio-misc
in repository https://gitbox.apache.org/repos/asf/cordova-paramedic.git.


    from d7fb517  comment note for default android emulator local IP that seems a bit strange
     new a3d7eed  Make sure all command executions output the command
     new 251aa29  additional comments and logging that explain what the code is doing and why

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 lib/ParamedicAppUninstall.js   |  3 ++-
 lib/ParamedicKill.js           |  5 +++--
 lib/ParamedicLog.js            |  3 ++-
 lib/ParamedicTargetChooser.js  |  3 ++-
 lib/ParamediciOSPermissions.js |  2 ++
 lib/PluginsManager.js          |  4 +++-
 lib/appium/AppiumRunner.js     |  6 +++++-
 lib/paramedic.js               | 20 ++++++++++++++++----
 lib/utils/utilities.js         |  7 ++++---
 9 files changed, 39 insertions(+), 14 deletions(-)


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


[cordova-paramedic] 02/02: additional comments and logging that explain what the code is doing and why

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

janpio pushed a commit to branch janpio-misc
in repository https://gitbox.apache.org/repos/asf/cordova-paramedic.git

commit 251aa295556b14a51e975c73c5de2aa21df7037b
Author: Jan Piotrowski <pi...@gmail.com>
AuthorDate: Fri Nov 30 12:17:00 2018 +0100

    additional comments and logging that explain what the code is doing and why
---
 lib/PluginsManager.js |  4 +++-
 lib/paramedic.js      | 16 +++++++++++++---
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/lib/PluginsManager.js b/lib/PluginsManager.js
index 7565a3b..690fc57 100644
--- a/lib/PluginsManager.js
+++ b/lib/PluginsManager.js
@@ -45,6 +45,8 @@ PluginsManager.prototype.installTestsForExistingPlugins = function () {
         // there is test plugin available
         if (fs.existsSync(path.join(plugin.dir, 'tests', 'plugin.xml'))) {
             var additionalArgs = "";
+
+            // special handling for cordova-plugin-file-transfer
             if (plugin.id.indexOf('cordova-plugin-file-transfer') >= 0) {
                 if (me.config.getFileTransferServer()) {
                     // user specified a file transfer server address, so using it
@@ -87,7 +89,7 @@ PluginsManager.prototype.installSinglePlugin = function (plugin) {
 };
 
 PluginsManager.prototype.showPluginsVersions = function () {
-    logger.verbose('cordova-paramedic: versions of installed plugins: ');
+    logger.normal('cordova-paramedic: versions of installed plugins: ');
     exec(this.config.getCli() + ' plugins' + util.PARAMEDIC_COMMON_CLI_ARGS);
 };
 
diff --git a/lib/paramedic.js b/lib/paramedic.js
index a74e142..afaa752 100644
--- a/lib/paramedic.js
+++ b/lib/paramedic.js
@@ -324,6 +324,8 @@ ParamedicRunner.prototype.runLocalTests = function () {
         return Q(util.TEST_PASSED);
     }
 
+    logger.info('cordova-paramedic: running tests locally');
+
     return Q().then(function () {
         return self.maybeRunFileTransferServer();
     })
@@ -378,9 +380,14 @@ ParamedicRunner.prototype.runLocalTests = function () {
 ParamedicRunner.prototype.runAppiumTests = function (useSauce) {
     var platform = this.config.getPlatformId();
     var self = this;
+    logger.normal('Start running Appium tests...');
 
-    if (self.config.getAction() === 'build' || !self.config.runAppiumTests()) {
-        logger.normal('Skipping Appium tests...');
+    if (self.config.getAction() === 'build') {
+        logger.normal('Skipping Appium tests: action = build ...');
+        return Q(util.TEST_PASSED);
+    }
+    if (!self.config.runAppiumTests()) {
+        logger.normal('Skipping Appium tests: not configured to run ...');
         return Q(util.TEST_PASSED);
     }
     if (platform !== util.ANDROID && platform !== util.IOS) {
@@ -389,7 +396,7 @@ ParamedicRunner.prototype.runAppiumTests = function (useSauce) {
         return Q(util.TEST_PASSED);
     }
     if (!useSauce && (!self.targetObj || !self.targetObj.target)) {
-        throw new Error('Cannot determine device name for Appium');
+        throw new Error('Cannot determine local device name for Appium');
     }
 
     logger.normal('Running Appium tests ' + (useSauce ? 'on Sauce Labs' : 'locally'));
@@ -440,6 +447,7 @@ ParamedicRunner.prototype.runAppiumTests = function (useSauce) {
 ParamedicRunner.prototype.runTests = function () {
     var isTestPassed = false;
     var self = this;
+    // Sauce Labs
     if (this.config.shouldUseSauce()) {
         return this.runSauceTests()
         .then(function (result) {
@@ -449,6 +457,7 @@ ParamedicRunner.prototype.runTests = function () {
         .then(function (isAppiumTestPassed) {
             return isTestPassed == util.TEST_PASSED && isAppiumTestPassed == util.TEST_PASSED;
         });
+    // Not Sauce Labs
     } else {
         return this.runLocalTests()
         .then(function (result) {
@@ -927,6 +936,7 @@ ParamedicRunner.prototype.runSauceTests = function () {
     logger.info('cordova-paramedic: running tests with sauce');
 
     return Q().then(function () {
+        // Build + "Upload" app
         if (self.config.getPlatformId() === util.BROWSER) {
             // for browser, we need to serve the app for Sauce Connect
             // we do it by just running "cordova run" and ignoring the chrome instance that pops up


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


[cordova-paramedic] 01/02: Make sure all command executions output the command

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

janpio pushed a commit to branch janpio-misc
in repository https://gitbox.apache.org/repos/asf/cordova-paramedic.git

commit a3d7eed7423f082afdb47594bf3685b242393b0a
Author: Jan Piotrowski <pi...@gmail.com>
AuthorDate: Fri Nov 30 12:15:45 2018 +0100

    Make sure all command executions output the command
---
 lib/ParamedicAppUninstall.js   | 3 ++-
 lib/ParamedicKill.js           | 5 +++--
 lib/ParamedicLog.js            | 3 ++-
 lib/ParamedicTargetChooser.js  | 3 ++-
 lib/ParamediciOSPermissions.js | 2 ++
 lib/appium/AppiumRunner.js     | 6 +++++-
 lib/paramedic.js               | 4 +++-
 lib/utils/utilities.js         | 7 ++++---
 8 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/lib/ParamedicAppUninstall.js b/lib/ParamedicAppUninstall.js
index 8188cc3..ff67030 100644
--- a/lib/ParamedicAppUninstall.js
+++ b/lib/ParamedicAppUninstall.js
@@ -23,6 +23,7 @@ var fs      = require('fs');
 var logger  = require('./utils').logger;
 var util    = require('./utils').utilities;
 var Q       = require('q');
+var exec    = require('./utils').exec;
 
 function ParamedicAppUninstall(appPath, platform) {
     this.appPath = appPath;
@@ -75,7 +76,7 @@ ParamedicAppUninstall.prototype.uninstallAppIOS = function (targetObj, app) {
 ParamedicAppUninstall.prototype.executeUninstallCommand = function (uninstallCommand) {
     return Q.Promise(function (resolve, reject, notify) {
         logger.info('cordova-paramedic: Running command: ' + uninstallCommand);
-        shelljs.exec(uninstallCommand, function (code, stdout, stderr) {
+        exec(uninstallCommand, function (code, stdout, stderr) {
             if (code === 0) {
                 resolve();
             } else {
diff --git a/lib/ParamedicKill.js b/lib/ParamedicKill.js
index 4986b3d..6ae8211 100644
--- a/lib/ParamedicKill.js
+++ b/lib/ParamedicKill.js
@@ -24,6 +24,7 @@
 var shelljs = require('shelljs');
 var util    = require('./utils').utilities;
 var logger  = require('./utils').logger;
+var exec    = require('./utils').exec;
 
 function ParamedicKill(platform) {
     this.platform = platform;
@@ -87,7 +88,7 @@ ParamedicKill.prototype.killTasks = function (taskNames) {
     logger.info('running the following command:');
     logger.info('    ' + command);
 
-    var killTasksResult = shelljs.exec(command, {silent: false, async: false });
+    var killTasksResult = exec(command, {silent: false, async: false });
     if (killTasksResult.code !== 0) {
         console.warn('WARNING: kill command returned ' + killTasksResult.code);
     }
@@ -115,7 +116,7 @@ ParamedicKill.prototype.killAdbServer = function () {
     logger.info('Running the following command:');
     logger.info('    ' + killServerCommand);
 
-    var killServerResult = shelljs.exec(killServerCommand, {silent: false, async: false});
+    var killServerResult = exec(killServerCommand, {silent: false, async: false});
     if (killServerResult.code !== 0) {
         logger.error('Failed killing adb server with code: ' + killServerResult.code);
     }
diff --git a/lib/ParamedicLog.js b/lib/ParamedicLog.js
index 0cb159b..0eee617 100644
--- a/lib/ParamedicLog.js
+++ b/lib/ParamedicLog.js
@@ -28,6 +28,7 @@ var fs       = require('fs');
 var path     = require('path-extra');
 var util     = require('./utils').utilities;
 var logger   = require('./utils').logger;
+var exec     = require('./utils').exec;
 
 function ParamedicLog(platform, appPath, outputDir, targetObj) {
     this.platform = platform;
@@ -84,7 +85,7 @@ ParamedicLog.prototype.generateLogs = function (logCommand) {
     var logFile = this.getLogFileName();
     logger.info('Running Command: ' + logCommand);
 
-    var result = shelljs.exec(logCommand, {silent: true, async: false});
+    var result = exec(logCommand, {silent: true, async: false});
     if (result.code > 0) {
         logger.error('Failed to run command: ' + logCommand);
         logger.error('Failure code: ' + result.code);
diff --git a/lib/ParamedicTargetChooser.js b/lib/ParamedicTargetChooser.js
index 6b162ad..cd7154d 100644
--- a/lib/ParamedicTargetChooser.js
+++ b/lib/ParamedicTargetChooser.js
@@ -23,6 +23,7 @@ var path          = require('path-extra');
 var logger        = require('./utils').logger;
 var util          = require('./utils').utilities;
 var ParamedicKill = require('./ParamedicKill');
+var exec          = require('./utils').exec;
 
 var ANDROID_RETRY_TIMES = 3;
 var ANDROID_TIME_OUT    = 300000; //5 Minutes
@@ -106,7 +107,7 @@ ParamedicTargetChooser.prototype.chooseTargetForWindows = function (emulator, ta
     var windowsCommand = this.cli + ' run --list --emulator' + util.PARAMEDIC_COMMON_CLI_ARGS;
 
     logger.info('cordova-paramedic: Running command: ' + windowsCommand);
-    var devicesResult = shelljs.exec(windowsCommand, {silent: true, async: false});
+    var devicesResult = exec(windowsCommand, {silent: true, async: false});
     if (devicesResult.code > 0) {
         logger.error('Failed to get the list of devices for windows');
         return Q({target: undefined});
diff --git a/lib/ParamediciOSPermissions.js b/lib/ParamediciOSPermissions.js
index 646d1c0..901a5be 100644
--- a/lib/ParamediciOSPermissions.js
+++ b/lib/ParamediciOSPermissions.js
@@ -57,6 +57,7 @@ ParamediciOSPermissions.prototype.updatePermissions = function (serviceList){
         logger.info('Running Command: ' + command);
         // If the service has an entry already, the insert command will fail.
         // in this case we'll process with updating existing entry
+        console.log('$ ' + command)
         var proc = shelljs.exec(command, {silent: true, async: false});
         if (proc.code) {
             logger.warn('Failed to insert permissions for ' + this.appName + ' into ' + destinationTCCFile +
@@ -68,6 +69,7 @@ ParamediciOSPermissions.prototype.updatePermissions = function (serviceList){
                 'where service=\'%s\' and client=\'%s\'"', destinationTCCFile, serviceList[i], this.appName);
             logger.info('Running Command: ' + command);
             // Now we really don't care about the result as there is nothing we can do with this
+            console.log('$ ' + command)
             var patchProc = shelljs.exec(command, {silent: true, async: false});
             if (patchProc.code) {
                 logger.warn('Failed to update existing permissions for ' + this.appName + ' into ' + destinationTCCFile +
diff --git a/lib/appium/AppiumRunner.js b/lib/appium/AppiumRunner.js
index e647ee7..ac1e796 100644
--- a/lib/appium/AppiumRunner.js
+++ b/lib/appium/AppiumRunner.js
@@ -41,6 +41,7 @@ var Reporters        = require('../Reporters');
 var execPromise      = require('../utils').execPromise;
 var Reporters        = require('../Reporters');
 var portChecker      = require('tcp-port-used');
+var exec             = require('../utils').exec;
 
 var SMALL_BUFFER_SIZE = 1024 * 1024;
 var BIG_BUFFER_SIZE = 50 * 1024 * 1024;
@@ -111,7 +112,7 @@ function runCommand(command, appPath) {
     if (appPath) {
         shell.pushd(appPath);
     }
-    shell.exec(command);
+    exec(command);
     if (appPath) {
         shell.popd();
     }
@@ -240,6 +241,7 @@ AppiumRunner.prototype.startIosProxy = function () {
         logger.normal('paramedic-appium: Running:');
         logger.normal('paramedic-appium: ' + iosProxyCommand);
         self.iosProxy.alive = true;
+        console.log('$ ' + iosProxyCommand)
         self.iosProxy.process = child_process.exec(iosProxyCommand, { maxBuffer: BIG_BUFFER_SIZE }, function () {
             self.iosProxy.alive = false;
             logger.normal('paramedic-appium: iOS proxy process exited.');
@@ -279,6 +281,7 @@ AppiumRunner.prototype.startAppiumServer = function () {
     logger.normal('paramedic-appium: Running:');
     logger.normal('paramedic-appium: ' + appiumServerCommand);
     self.appium.alive = true;
+    console.log('$ ' + appiumServerCommand)
     self.appium.process = child_process.exec(appiumServerCommand, { maxBuffer: BIG_BUFFER_SIZE }, function (error) {
         logger.normal('paramedic-appium: Appium process exited.');
         if (self.appium.alive && error) {
@@ -382,6 +385,7 @@ AppiumRunner.prototype.prepareApp = function () {
 
         // rebuild the app
         logger.normal('paramedic-appium: Building the app...');
+        console.log('$ ' + buildCommand)
         child_process.exec(buildCommand, { cwd: fullAppPath, maxBuffer: SMALL_BUFFER_SIZE }, function (error, stdout, stderr) {
             if (error || stdout.indexOf('BUILD FAILED') >= 0 || stderr.indexOf('BUILD FAILED') >= 0) {
                 d.reject('Couldn\'t build the app: ' + error);
diff --git a/lib/paramedic.js b/lib/paramedic.js
index 9bc7a26..a74e142 100644
--- a/lib/paramedic.js
+++ b/lib/paramedic.js
@@ -337,6 +337,7 @@ ParamedicRunner.prototype.runLocalTests = function () {
         if (self.config.getPlatformId() !== util.BROWSER) {
             return execPromise(command);
         }
+        console.log('$ ' + command)
         runProcess = cp.exec(command, function () {
             // a precaution not to try to kill some other process
             runProcess = null;
@@ -594,7 +595,7 @@ ParamedicRunner.prototype.packageApp = function () {
                 shell.pushd(self.getPackageFolder());
                 shell.rm('-rf', self.getPackageName());
                 console.log('Running command: ' + zipCommand + ' in dir: ' + shell.pwd());
-                shell.exec(zipCommand, { silent: !self.config.isVerbose() }, function (code, stdout, stderr) {
+                exec(zipCommand, { silent: !self.config.isVerbose() }, function (code, stdout, stderr) {
                     shell.popd();
                     if (code) {
                         reject('zip command returned with error code ' + code);
@@ -936,6 +937,7 @@ ParamedicRunner.prototype.runSauceTests = function () {
                     return self.getCommandForStartingTests();
                 })
                 .then(function (command) {
+                    console.log('$ ' + command)
                     runProcess = cp.exec(command, function onExit() {
                         // a precaution not to try to kill some other process
                         runProcess = null;
diff --git a/lib/utils/utilities.js b/lib/utils/utilities.js
index a2c7fbb..45a85a1 100644
--- a/lib/utils/utilities.js
+++ b/lib/utils/utilities.js
@@ -26,6 +26,7 @@ var util    = require('util');
 var path    = require('path-extra');
 var logger  = require('cordova-common').CordovaLogger.get();
 var kill    = require('tree-kill');
+var exec    = require('./execWrapper').exec
 
 var HEADING_LINE_PATTERN = /List of devices/m;
 var DEVICE_ROW_PATTERN   = /(emulator|device|host)/m;
@@ -43,7 +44,7 @@ function countAndroidDevices() {
     logger.info('    ' + listCommand);
 
     var numDevices = 0;
-    var result = shelljs.exec(listCommand, {silent: false, async: false});
+    var result = exec(listCommand, {silent: false, async: false});
     result.output.split('\n').forEach(function (line) {
         if (!HEADING_LINE_PATTERN.test(line) && DEVICE_ROW_PATTERN.test(line)) {
             numDevices += 1;
@@ -72,7 +73,7 @@ function getSimulatorModelId(cli, target) {
     logger.info('running:');
     logger.info('    ' + findSimCommand);
 
-    var findSimResult = shelljs.exec(findSimCommand, {silent: true, async: false});
+    var findSimResult = exec(findSimCommand, {silent: true, async: false});
 
     if (findSimResult.code > 0) {
         logger.error('Failed to find simulator we deployed to');
@@ -95,7 +96,7 @@ function getSimulatorId(findSimResult) {
     logger.info('running:');
     logger.info('    ' + instrCommand);
 
-    var instrResult = shelljs.exec(instrCommand, {silent: true, async: false});
+    var instrResult = exec(instrCommand, {silent: true, async: false});
 
     if (instrResult.code > 0) {
         logger.error('Failed to get the list of simulators');


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