From f122b0562a29ca151d8b4d9b60fe979ba4106ead Mon Sep 17 00:00:00 2001 From: Jonathan Lipps Date: Fri, 22 Aug 2014 21:27:25 -0400 Subject: [PATCH] make sure executeAsync callback address/port aren't lost between sessions cc @sebv, this is what was going wrong before --- lib/appium.js | 9 ++++++--- lib/devices/ios/ios-controller.js | 1 + test/functional/common/webview/basics-base.js | 4 +--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/appium.js b/lib/appium.js index d163edad2..f2a36da0e 100644 --- a/lib/appium.js +++ b/lib/appium.js @@ -23,7 +23,12 @@ var DT_IOS = "ios" var Appium = function (args) { this.args = _.clone(args); - this.serverArgs = _.clone(args); + this.args.callbackAddress = this.args.callbackAddress || this.args.address; + this.args.callbackPort = this.args.callbackPort || this.args.port; + // we need to keep an unmodified copy of the args so that we can restore + // any server arguments between sessions to their default values + // (otherwise they might be overridden by session-level caps) + this.serverArgs = _.clone(this.args); this.rest = null; this.webSocket = null; this.deviceType = null; @@ -38,8 +43,6 @@ var Appium = function (args) { this.defCommandTimeoutMs = this.args.defaultCommandTimeout * 1000; this.commandTimeoutMs = this.defCommandTimeoutMs; this.commandTimeout = null; - this.args.callbackAddress = this.args.callbackAddress || this.args.address; - this.args.callbackPort = this.args.callbackPort || this.args.port; }; Appium.prototype.attachTo = function (rest) { diff --git a/lib/devices/ios/ios-controller.js b/lib/devices/ios/ios-controller.js index bdd8bac39..a5e09e39c 100644 --- a/lib/devices/ios/ios-controller.js +++ b/lib/devices/ios/ios-controller.js @@ -1796,6 +1796,7 @@ iOSController.execute = function (script, args, cb) { iOSController.executeAsync = function (script, args, responseUrl, cb) { if (this.isWebContext()) { + logger.debug("Response url for executeAsync is " + responseUrl); this.convertElementForAtoms(args, function (err, res) { if (err) { cb(null, res); diff --git a/test/functional/common/webview/basics-base.js b/test/functional/common/webview/basics-base.js index f13d40963..c7f0fbd5c 100644 --- a/test/functional/common/webview/basics-base.js +++ b/test/functional/common/webview/basics-base.js @@ -1,11 +1,9 @@ "use strict"; -var env = require('../../../helpers/env'), - setup = require("../setup-base"), +var setup = require("../setup-base"), webviewHelper = require("../../../helpers/webview"), loadWebView = webviewHelper.loadWebView, isChrome = webviewHelper.isChrome, - ChaiAsserter = require('../../../helpers/asserter.js').ChaiAsserter, Q = require('q'), spinTitle = webviewHelper.spinTitle, spinWait = require('../../../helpers/spin.js').spinWait,