Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 843B3200B30 for ; Mon, 4 Jul 2016 16:01:37 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 82BB5160A65; Mon, 4 Jul 2016 14:01:37 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id CB726160A34 for ; Mon, 4 Jul 2016 16:01:36 +0200 (CEST) Received: (qmail 78665 invoked by uid 500); 4 Jul 2016 14:01:35 -0000 Mailing-List: contact dev-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list dev@cordova.apache.org Received: (qmail 78654 invoked by uid 99); 4 Jul 2016 14:01:35 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Jul 2016 14:01:35 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 31597E03C0; Mon, 4 Jul 2016 14:01:35 +0000 (UTC) From: vladimir-kotikov To: dev@cordova.apache.org Reply-To: dev@cordova.apache.org References: In-Reply-To: Subject: [GitHub] cordova-paramedic pull request #11: Appium tests Content-Type: text/plain Message-Id: <20160704140135.31597E03C0@git1-us-west.apache.org> Date: Mon, 4 Jul 2016 14:01:35 +0000 (UTC) archived-at: Mon, 04 Jul 2016 14:01:37 -0000 Github user vladimir-kotikov commented on a diff in the pull request: https://github.com/apache/cordova-paramedic/pull/11#discussion_r69461861 --- Diff: lib/paramedic.js --- @@ -190,48 +192,160 @@ ParamedicRunner.prototype.writeMedicConnectionUrl = function(url) { fs.writeFileSync(path.join('www','medic.json'), JSON.stringify({logurl:url})); }; -ParamedicRunner.prototype.runTests = function () { +ParamedicRunner.prototype.buildApp = function () { var self = this; - if (this.config.shouldUseSauce()) { - var command = this.getCommandForBuilding(); + var command = this.getCommandForBuilding(); + + logger.normal('cordova-paramedic: running command ' + command); + + return execPromise(command) + .fail(function(output) { + // this trace is automatically available in verbose mode + // so we check for this flag to not trace twice + if (!self.config.verbose) { + logger.normal(output); + } + logger.normal('cordova-paramedic: unable to build project; command log is available above'); + throw new Error('Unable to build project.'); + }); +}; + +ParamedicRunner.prototype.runLocalTests = function () { + var self = this; + + return self.getCommandForStartingTests() + .then(function(command) { + self.setPermissions(); logger.normal('cordova-paramedic: running command ' + command); - return execPromise(command) - .then(self.runSauceTests.bind(self), function(output) { - // this trace is automatically available in verbose mode - // so we check for this flag to not trace twice - if (!self.config.verbose) { - logger.normal(output); - } - logger.normal('cordova-paramedic: unable to build project; command log is available above'); - throw new Error('Command "' + command + '" failed.'); + return execPromise(command); + }) + .then(function() { + // skip tests if it was just build + if (self.shouldWaitForTestResult()) { + return Q.promise(function(resolve, reject) { + // reject if timed out + self.waitForConnection().catch(reject); + // resolve if got results + self.waitForTests().then(resolve); + }); + } + }, function(output) { + // this trace is automatically available in verbose mode + // so we check for this flag to not trace twice + if (!self.config.verbose) { + logger.normal(output); + } + logger.normal('cordova-paramedic: unable to run tests; command log is available above'); + throw new Error('Unable to run tests.'); + }); +}; + +ParamedicRunner.prototype.getAppiumDeviceName = function () { + if (!this.targetObj) { + return ''; + } + if (this.config.getPlatformId() === 'ios') { + return this.targetObj.target.replace('-', ' '); + } + return this.targetObj.target; +}; + +ParamedicRunner.prototype.runAppiumTests = function () { + var platform = this.config.getPlatformId(); + if (platform !== 'android' && platform !== 'ios') { + logger.warn('Unsupported platform for Appium test run: ' + platform); + return Q(true); + } + var self = this; + + logger.normal('Running Appium tests locally.'); + + var options = { + platform: self.config.getPlatformId(), + appPath: self.tempFolder.name, + appiumDeviceName: self.getAppiumDeviceName(), + appiumPlatformVersion: null, + device: false, --- End diff -- Can we set default values for these two parameters in `AppiumRunner`'s constructor instead? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org For additional commands, e-mail: dev-help@cordova.apache.org