appium-uiauto
Advanced tools
Comparing version 1.7.11 to 1.7.13
{ | ||
"name": "appium-uiauto", | ||
"version": "1.7.11", | ||
"version": "1.7.13", | ||
"description": "appium uiauto ios driver", | ||
@@ -5,0 +5,0 @@ "main": "lib/main.js", |
@@ -6,13 +6,59 @@ /* globals $ */ | ||
$.extend($, { | ||
system: function () { return UIATarget.localTarget().host(); } | ||
system: function () { return $.target().host(); } | ||
, target: function () { return UIATarget.localTarget(); } | ||
, mainWindow: function () { return UIATarget.localTarget().frontMostApp().mainWindow(); } | ||
, mainApp: function () { return UIATarget.localTarget().frontMostApp(); } | ||
, keyboard: function () { return UIATarget.localTarget().frontMostApp().keyboard(); } | ||
, bundleId: function () { return UIATarget.localTarget().frontMostApp().bundleID(); } | ||
, mainWindow: function () { return $.mainApp().mainWindow(); } | ||
, mainApp: function () { | ||
var app = null; | ||
if (!$.tryWaitForCondition(function() { | ||
app = $.target().frontMostApp(); | ||
return app && app.isValid(); })) { | ||
throw new Error("No valid frontmost app was found."); | ||
} | ||
return app; | ||
} | ||
, keyboard: function () { | ||
var appKeyboard = null; | ||
if (!$.tryWaitForCondition(function() { | ||
appKeyboard = $.mainApp().keyboard(); | ||
return appKeyboard && appKeyboard.isValid(); })) { | ||
throw new Error("Could not locate keyboard."); | ||
} | ||
return appKeyboard; | ||
} | ||
, bundleId: function () { return $.mainApp().bundleID(); } | ||
// overriding existing delay | ||
, delay: function (ms) { delaySec.call(this, ms/1000); } | ||
, logTree: function () {$($.mainApp()).logTree();} | ||
, debug: function (s) { if ($.isVerbose) UIALogger.logDebug(s); } | ||
, tryWaitForCondition: function(condition, interval) { | ||
if (typeof condition !== 'function') { | ||
throw new Error("Must provide a callback returning a boolean.") | ||
} | ||
var i = interval || 20, t = 0; | ||
var isMet = condition(); | ||
while (t < 3000 && !isMet) { | ||
t += i; | ||
$.delay(i); | ||
isMet = condition(); | ||
} | ||
return isMet; | ||
} | ||
}); | ||
})(); |
@@ -49,13 +49,2 @@ /* globals $, ERROR */ | ||
, _tryWaitKbHidden: function() { | ||
var interval = 50, t = 0; | ||
while(t < 3000 && !$.mainApp().keyboard().isNil()) { | ||
t += interval; | ||
$.delay(interval); | ||
} | ||
return $.mainApp().keyboard().isNil(); | ||
} | ||
, _pressKeyToHideKeyboard: function (keyName) { | ||
@@ -101,3 +90,3 @@ $.debug("Hiding keyboard with keyName " + keyName); | ||
if(!$._tryWaitKbHidden()) { | ||
if(!$.tryWaitForCondition(function(){ return $.mainApp().keyboard().isNil(); })) { | ||
throw new Error("Failed to hide keyboard."); | ||
@@ -104,0 +93,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13583630
3638