Repository: cordova-paramedic Updated Branches: refs/heads/master ffa40f80b -> bd04d5f53
CB-11926 Pass the file transfer server address to the tests via variable Project: http://git-wip-us.apache.org/repos/asf/cordova-paramedic/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-paramedic/commit/bd04d5f5 Tree: http://git-wip-us.apache.org/repos/asf/cordova-paramedic/tree/bd04d5f5 Diff: http://git-wip-us.apache.org/repos/asf/cordova-paramedic/diff/bd04d5f5 Branch: refs/heads/master Commit: bd04d5f532e30c0f7c3a773eff7944d705b9fb15 Parents: ffa40f8 Author: Alexander Sorokin <[email protected]> Authored: Mon Oct 3 19:37:16 2016 +0300 Committer: Alexander Sorokin <[email protected]> Committed: Tue Oct 4 22:46:53 2016 +0300 ---------------------------------------------------------------------- README.md | 5 +++-- lib/LocalServer.js | 2 +- lib/ParamedicKill.js | 6 +++--- lib/PluginsManager.js | 24 ++++++++++++++++++++---- lib/paramedic.js | 15 +++++---------- paramedic-plugin/paramedic.js | 7 +------ 6 files changed, 33 insertions(+), 26 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-paramedic/blob/bd04d5f5/README.md ---------------------------------------------------------------------- diff --git a/README.md b/README.md index 15116f2..b21ac41 100644 --- a/README.md +++ b/README.md @@ -43,11 +43,12 @@ cordova-paramedic --platform ios@https://github.com/apache/cordova-ios.git#4.1.0 ####`--plugin` (required) -Specifies test plugin, you may specify multiple --plugin flags and they will all be installed and tested together. Similat to `platform` parameter you can refer to local (or absolute) path, npm registry or git repo. +Specifies test plugin, you may specify multiple --plugin flags and they will all be installed and tested together. You can refer to absolute path, npm registry or git repo. +If the plugin requires variables to install, you can specify them along with its name. ``` cordova-paramedic --platform ios --plugin cordova-plugin-inappbrowser -cordova-paramedic --platform ios --plugin ../cordova-plugin-inappbrowser +cordova-paramedic --platform ios --plugin 'azure-mobile-engagement-cordova --variable AZME_IOS_CONNECTION_STRING=Endpoint=0;AppId=0;SdkKey=0' cordova-paramedic --platform ios --plugin https://github.com/apache/cordova-plugin-inappbrowser // several plugins cordova-paramedic --platform ios --plugin cordova-plugin-inappbrowser --plugin cordova-plugin-contacts http://git-wip-us.apache.org/repos/asf/cordova-paramedic/blob/bd04d5f5/lib/LocalServer.js ---------------------------------------------------------------------- diff --git a/lib/LocalServer.js b/lib/LocalServer.js index 0a2b2f3..0ea814c 100644 --- a/lib/LocalServer.js +++ b/lib/LocalServer.js @@ -87,7 +87,7 @@ LocalServer.prototype.startFileTransferServer = function (tempPath) { return Q().then(function () { shell.pushd(tempPath); - logger.normal('local-server: cloning file tranfer server'); + logger.normal('local-server: cloning file transfer server'); return exec('git clone https://github.com/apache/cordova-labs --branch cordova-filetransfer'); }).then(function () { shell.pushd('cordova-labs'); http://git-wip-us.apache.org/repos/asf/cordova-paramedic/blob/bd04d5f5/lib/ParamedicKill.js ---------------------------------------------------------------------- diff --git a/lib/ParamedicKill.js b/lib/ParamedicKill.js index 3adc631..3a3f7df 100644 --- a/lib/ParamedicKill.js +++ b/lib/ParamedicKill.js @@ -62,9 +62,9 @@ ParamedicKill.prototype.tasksOnPlatform = function (platformName) { break; case util.ANDROID: if (util.isWindows()) { - tasks = ['emulator-arm.exe']; + tasks = ['emulator-arm.exe', 'qemu-system-i386.exe']; } else { - tasks = ['emulator64-x86', 'emulator64-arm']; + tasks = ['emulator64-x86', 'emulator64-arm', 'qemu-system-i386']; } break; } @@ -92,7 +92,7 @@ ParamedicKill.prototype.getKillCommand = function (taskNames) { var args; if (util.isWindows()) { - cli = 'taskkill /F'; + cli = 'taskkill /t /F'; args = taskNames.map(function (name) { return '/IM "' + name + '"'; }); } else { cli = 'killall -9'; http://git-wip-us.apache.org/repos/asf/cordova-paramedic/blob/bd04d5f5/lib/PluginsManager.js ---------------------------------------------------------------------- diff --git a/lib/PluginsManager.js b/lib/PluginsManager.js index 755c67c..222193f 100644 --- a/lib/PluginsManager.js +++ b/lib/PluginsManager.js @@ -22,10 +22,12 @@ var fs = require('fs'); var logger = require('./utils').logger; var exec = require('./utils').exec; var PluginInfoProvider = require('cordova-common').PluginInfoProvider; +var Server = require('./LocalServer'); -function PluginsManager(appRoot, storedCWD) { +function PluginsManager(appRoot, storedCWD, config) { this.appRoot = appRoot; this.storedCWD = storedCWD; + this.config = config; } PluginsManager.prototype.installPlugins = function (plugins) { @@ -41,7 +43,13 @@ PluginsManager.prototype.installTestsForExistingPlugins = function () { installedPlugins.forEach(function(plugin) { // there is test plugin available if (fs.existsSync(path.join(plugin.dir, 'tests', 'plugin.xml'))) { - me.installSinglePlugin(path.join(plugin.dir, 'tests')); + var additionalArgs = ''; + if (plugin.id.indexOf('cordova-plugin-file-transfer') >= 0) { + var server = new Server(0, me.config.getExternalServerUrl()); + var fileServerUrl = server.getConnectionAddress(me.config.getPlatformId()) + ':5000'; + additionalArgs += ' --variable FILETRANSFER_SERVER_ADDRESS=' + fileServerUrl; + } + me.installSinglePlugin(path.join(plugin.dir, 'tests') + additionalArgs); } }); // this will list installed plugins and their versions @@ -49,8 +57,16 @@ PluginsManager.prototype.installTestsForExistingPlugins = function () { }; PluginsManager.prototype.installSinglePlugin = function (plugin) { - if (fs.existsSync(path.resolve(this.storedCWD, plugin))) { - plugin = path.resolve(this.storedCWD, plugin); + var pluginPath = plugin; + var args = ''; + // separate plugin name from args + var argsIndex = plugin.indexOf(' --'); + if (argsIndex > 0) { + pluginPath = plugin.substring(0, argsIndex); + args = plugin.substring(argsIndex); + } + if (fs.existsSync(path.resolve(this.storedCWD, pluginPath))) { + plugin = path.resolve(this.storedCWD, pluginPath) + args; } logger.normal('cordova-paramedic: installing ' + plugin); http://git-wip-us.apache.org/repos/asf/cordova-paramedic/blob/bd04d5f5/lib/paramedic.js ---------------------------------------------------------------------- diff --git a/lib/paramedic.js b/lib/paramedic.js index 689d89f..2d56080 100644 --- a/lib/paramedic.js +++ b/lib/paramedic.js @@ -85,9 +85,8 @@ ParamedicRunner.prototype.run = function () { self.injectReporters(); self.subcribeForEvents(); - var logUrl = server.getConnectionUrl(self.config.getPlatformId()); - var fileServerUrl = server.getConnectionAddress(self.config.getPlatformId()) + ':5000'; - self.writeMedicJson(logUrl, fileServerUrl); + var logUrl = self.server.getConnectionUrl(self.config.getPlatformId()); + self.writeMedicJson(logUrl); logger.normal('Start running tests at ' + (new Date()).toLocaleTimeString()); } @@ -125,7 +124,7 @@ ParamedicRunner.prototype.prepareProjectToRunTests = function () { ParamedicRunner.prototype.installPlugins = function () { logger.info('cordova-paramedic: installing plugins'); - this.pluginsManager = new PluginsManager(this.tempFolder.name, this.storedCWD); + this.pluginsManager = new PluginsManager(this.tempFolder.name, this.storedCWD, this.config); this.pluginsManager.installPlugins(this.config.getPlugins()); this.pluginsManager.installTestsForExistingPlugins(); @@ -199,14 +198,10 @@ ParamedicRunner.prototype.subcribeForEvents = function () { }); }; -ParamedicRunner.prototype.writeMedicJson = function(logUrl, fileServerUrl) { +ParamedicRunner.prototype.writeMedicJson = function(logUrl) { logger.normal('cordova-paramedic: writing medic log url to project ' + logUrl); - logger.normal('cordova-paramedic: writing file server url to project ' + fileServerUrl); - fs.writeFileSync(path.join('www','medic.json'), JSON.stringify({ - logurl:logUrl, - fileserverurl: fileServerUrl - })); + fs.writeFileSync(path.join('www','medic.json'), JSON.stringify({logurl:logUrl})); }; ParamedicRunner.prototype.buildApp = function () { http://git-wip-us.apache.org/repos/asf/cordova-paramedic/blob/bd04d5f5/paramedic-plugin/paramedic.js ---------------------------------------------------------------------- diff --git a/paramedic-plugin/paramedic.js b/paramedic-plugin/paramedic.js index e225e7a..8cf8159 100644 --- a/paramedic-plugin/paramedic.js +++ b/paramedic-plugin/paramedic.js @@ -21,7 +21,6 @@ var io = cordova.require('cordova-plugin-paramedic.socket.io'); var PARAMEDIC_SERVER_DEFAULT_URL = 'http://127.0.0.1:8008'; -var PARAMEDIC_FILESERVER_DEFAULT_URL = 'http://127.0.0.1:5000'; function Paramedic() { @@ -108,8 +107,7 @@ cordova.paramedic.initialize(); function getMedicConfig () { var cfg = { - logurl: PARAMEDIC_SERVER_DEFAULT_URL, - fileserverurl: PARAMEDIC_FILESERVER_DEFAULT_URL + logurl: PARAMEDIC_SERVER_DEFAULT_URL }; try { @@ -121,9 +119,6 @@ function getMedicConfig () { if (parsedCfg.logurl) { cfg.logurl = parsedCfg.logurl; } - if (parsedCfg.fileserverurl) { - cfg.fileserverurl = parsedCfg.fileserverurl; - } } catch (ex) { console.log('Unable to load paramedic server url: ' + ex); } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
