You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by al...@apache.org on 2016/08/12 07:49:46 UTC
cordova-paramedic git commit: CB-11684 Introduced --skipAppiumTests
and --skipMainTests args
Repository: cordova-paramedic
Updated Branches:
refs/heads/master 9ea17579f -> e2d6f96c9
CB-11684 Introduced --skipAppiumTests and --skipMainTests args
Project: http://git-wip-us.apache.org/repos/asf/cordova-paramedic/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-paramedic/commit/e2d6f96c
Tree: http://git-wip-us.apache.org/repos/asf/cordova-paramedic/tree/e2d6f96c
Diff: http://git-wip-us.apache.org/repos/asf/cordova-paramedic/diff/e2d6f96c
Branch: refs/heads/master
Commit: e2d6f96c9ecfb6e6a6159adf4bbec59f5f6707fb
Parents: 9ea1757
Author: Alexander Sorokin <al...@akvelon.com>
Authored: Tue Aug 9 12:10:16 2016 +0300
Committer: Alexander Sorokin <al...@akvelon.com>
Committed: Tue Aug 9 12:10:16 2016 +0300
----------------------------------------------------------------------
lib/ParamedicConfig.js | 20 ++++++++++++++++++-
lib/paramedic.js | 47 +++++++++++++++++++++++++++++++++++----------
main.js | 14 ++++++++++++--
3 files changed, 68 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-paramedic/blob/e2d6f96c/lib/ParamedicConfig.js
----------------------------------------------------------------------
diff --git a/lib/ParamedicConfig.js b/lib/ParamedicConfig.js
index e81f87c..2a1675c 100644
--- a/lib/ParamedicConfig.js
+++ b/lib/ParamedicConfig.js
@@ -62,7 +62,9 @@ ParamedicConfig.parseFromArguments = function (argv) {
sauceKey: argv.sauceKey,
sauceDeviceName: argv.sauceDeviceName && argv.sauceDeviceName.toString(),
saucePlatformVersion: argv.saucePlatformVersion && argv.saucePlatformVersion.toString(),
- sauceAppiumVersion: argv.sauceAppiumVersion && argv.sauceAppiumVersion.toString()
+ sauceAppiumVersion: argv.sauceAppiumVersion && argv.sauceAppiumVersion.toString(),
+ skipAppiumTests: argv.skipAppium,
+ skipMainTests: argv.skipMainTests
});
};
@@ -194,6 +196,22 @@ ParamedicConfig.prototype.setSauceAppiumVersion = function (sauceAppiumVersion)
this._config.sauceAppiumVersion = sauceAppiumVersion.toString();
};
+ParamedicConfig.prototype.runMainTests = function () {
+ return !this._config.skipMainTests;
+};
+
+ParamedicConfig.prototype.setSkipMainTests = function (skipMainTests) {
+ this._config.skipMainTests = skipMainTests;
+};
+
+ParamedicConfig.prototype.runAppiumTests = function () {
+ return !this._config.skipAppiumTests;
+};
+
+ParamedicConfig.prototype.setSkipAppiumTests = function (skipAppiumTests) {
+ this._config.skipAppiumTests = skipAppiumTests;
+};
+
ParamedicConfig.prototype.isBrowserify = function () {
return this._config.browserify;
};
http://git-wip-us.apache.org/repos/asf/cordova-paramedic/blob/e2d6f96c/lib/paramedic.js
----------------------------------------------------------------------
diff --git a/lib/paramedic.js b/lib/paramedic.js
index 12f7c8e..cd25465 100644
--- a/lib/paramedic.js
+++ b/lib/paramedic.js
@@ -66,22 +66,30 @@ ParamedicRunner.prototype.run = function () {
this.checkSauceRequirements();
+ if (!self.config.runMainTests() && !self.config.runAppiumTests()) {
+ throw new Error('No tests to run: both --skipAppiumTests and --skipMainTests are used');
+ }
+
return Q().then(function () {
self.createTempProject();
shell.pushd(self.tempFolder.name);
self.prepareProjectToRunTests();
- return Server.startServer(self.config.getPorts(), self.config.getExternalServerUrl(), self.config.getUseTunnel());
+ if (self.config.runMainTests()) {
+ return Server.startServer(self.config.getPorts(), self.config.getExternalServerUrl(), self.config.getUseTunnel());
+ }
})
.then(function (server) {
- self.server = server;
+ if (self.config.runMainTests()) {
+ self.server = server;
- self.injectReporters();
- self.subcribeForEvents();
+ self.injectReporters();
+ self.subcribeForEvents();
- var connectionUrl = server.getConnectionUrl(self.config.getPlatformId());
- self.writeMedicConnectionUrl(connectionUrl);
+ var connectionUrl = server.getConnectionUrl(self.config.getPlatformId());
+ self.writeMedicConnectionUrl(connectionUrl);
- logger.normal('Start running tests at ' + (new Date()).toLocaleTimeString());
+ logger.normal('Start running tests at ' + (new Date()).toLocaleTimeString());
+ }
return self.runTests();
})
.timeout(self.config.getTimeout(), 'Timed out after waiting for ' + self.config.getTimeout() + ' ms.')
@@ -212,6 +220,11 @@ ParamedicRunner.prototype.buildApp = function () {
ParamedicRunner.prototype.runLocalTests = function () {
var self = this;
+ if (!self.config.runMainTests() && self.config.getPlatformId() !== 'android') {
+ logger.normal('Skipping main tests...');
+ return Q(util.TEST_PASSED);
+ }
+
return self.getCommandForStartingTests()
.then(function(command) {
self.setPermissions();
@@ -220,6 +233,13 @@ ParamedicRunner.prototype.runLocalTests = function () {
return execPromise(command);
})
.then(function() {
+ // skipping here and not at the beginning because we need to
+ // start up the Android emulator for Appium tests to run on
+ if (!self.config.runMainTests()) {
+ logger.normal('Skipping main tests...');
+ return util.TEST_PASSED;
+ }
+
// skip tests if it was just build
if (self.shouldWaitForTestResult()) {
return Q.promise(function(resolve, reject) {
@@ -243,8 +263,9 @@ ParamedicRunner.prototype.runLocalTests = function () {
ParamedicRunner.prototype.runAppiumTests = function (useSauce) {
var platform = this.config.getPlatformId();
var self = this;
- if (self.config.getAction() === 'build') {
- logger.normal('Just building, so skipping Appium tests...');
+
+ if (self.config.getAction() === 'build' || !self.config.runAppiumTests()) {
+ logger.normal('Skipping Appium tests...');
return Q(util.TEST_PASSED);
}
if (platform !== 'android' && platform !== 'ios') {
@@ -678,12 +699,18 @@ ParamedicRunner.prototype.connectWebdriver = function () {
};
ParamedicRunner.prototype.runSauceTests = function () {
- logger.info('cordova-paramedic: running sauce tests');
var self = this;
var isTestPassed = false;
var pollForResults;
var driver;
+ if (!self.config.runMainTests()) {
+ logger.normal('Skipping main tests...');
+ return Q(util.TEST_PASSED);
+ }
+
+ logger.info('cordova-paramedic: running sauce tests');
+
return this.buildApp()
.then(self.packageApp.bind(self))
.then(self.uploadApp.bind(self))
http://git-wip-us.apache.org/repos/asf/cordova-paramedic/blob/e2d6f96c/main.js
----------------------------------------------------------------------
diff --git a/main.js b/main.js
index 65c763d..8e2b5e9 100755
--- a/main.js
+++ b/main.js
@@ -52,8 +52,10 @@ var USAGE = "Error missing args. \n" +
"--sauceUser: (optional) Saucelabs username\n" +
"--sauceKey: (optional) Saucelabs access key\n" +
"--sauceDeviceName: (optional) Name of the SauceLabs emulator. For example, \"iPhone Simulator\"\n" +
- "--saucePlatformVersion: (optional) Platform version of the SauceLabs emulator. For example, \"9.3\"" +
- "--sauceAppiumVersion: (optional) Appium version to use when running on Saucelabs. For example, \"1.5.3\"";
+ "--saucePlatformVersion: (optional) Platform version of the SauceLabs emulator. For example, \"9.3\"\n" +
+ "--sauceAppiumVersion: (optional) Appium version to use when running on Saucelabs. For example, \"1.5.3\"\n" +
+ "--skipMainTests: (optional) Do not run main (cordova-test-framework) tests\n" +
+ "--skipAppiumTests: (optional) Do not run Appium tests";
var argv = parseArgs(process.argv.slice(2));
var pathToParamedicConfig = argv.config && path.resolve(argv.config);
@@ -127,6 +129,14 @@ if (pathToParamedicConfig || // --config
paramedicConfig.setUseTunnel(argv.useTunnel);
}
+ if (argv.skipMainTests) {
+ paramedicConfig.setSkipMainTests(argv.skipMainTests);
+ }
+
+ if (argv.skipAppiumTests) {
+ paramedicConfig.setSkipAppiumTests(argv.skipAppiumTests);
+ }
+
paramedic.run(paramedicConfig)
.catch(function (error) {
if (error && error.stack) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org