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 2017/05/31 05:58:28 UTC

cordova-paramedic git commit: Fixed a windows handle error for long runs

Repository: cordova-paramedic
Updated Branches:
  refs/heads/master 9f99eee05 -> ec0903381


Fixed a windows handle error for long runs


Project: http://git-wip-us.apache.org/repos/asf/cordova-paramedic/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-paramedic/commit/ec090338
Tree: http://git-wip-us.apache.org/repos/asf/cordova-paramedic/tree/ec090338
Diff: http://git-wip-us.apache.org/repos/asf/cordova-paramedic/diff/ec090338

Branch: refs/heads/master
Commit: ec0903381debe1cbdd15db6124780655c676fb21
Parents: 9f99eee
Author: Alexander Sorokin <al...@akvelon.com>
Authored: Wed May 31 08:58:22 2017 +0300
Committer: Alexander Sorokin <al...@akvelon.com>
Committed: Wed May 31 08:58:22 2017 +0300

----------------------------------------------------------------------
 lib/appium/helpers/wdHelper.js | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-paramedic/blob/ec090338/lib/appium/helpers/wdHelper.js
----------------------------------------------------------------------
diff --git a/lib/appium/helpers/wdHelper.js b/lib/appium/helpers/wdHelper.js
index a029507..95b74e0 100644
--- a/lib/appium/helpers/wdHelper.js
+++ b/lib/appium/helpers/wdHelper.js
@@ -185,6 +185,7 @@ module.exports.tapElementByXPath = function (xpath, driver) {
 module.exports.pollForEvents = function (driver, platform, skipBuster, windowOffset) {
     var isAndroid = platform === 'android';
     var isIOS = platform === 'ios';
+    var currentHandle = '';
     if (!windowOffset) {
         windowOffset = 0;
     }
@@ -213,12 +214,13 @@ module.exports.pollForEvents = function (driver, platform, skipBuster, windowOff
             if (windowOffset >= windowHandles.length) {
                 throw new Error('Cannot find a window with the event cache.');
             }
+            currentHandle = windowHandles[windowOffset];
             // Android 7 workaround:
             // add current window to the blacklist
             // because "execute" can just not work on one of the windows
             // so we're not trying the same window twice
-            windowBlacklist.push(windowHandles[windowOffset]);
-            return driver.window(windowHandles[windowOffset]);
+            windowBlacklist.push(currentHandle);
+            return driver.window(currentHandle);
         });
     })
     .execute(function () {
@@ -232,6 +234,8 @@ module.exports.pollForEvents = function (driver, platform, skipBuster, windowOff
         return result;
     }, [])
     .then(function (result) {
+        // do not blacklist the right window!
+        windowBlacklist.splice(windowBlacklist.indexOf(currentHandle), 1);
         if (Object.prototype.toString.call(result) === '[object Array]') {
             return result;
         }


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