marionette-client
Advanced tools
Comparing version 0.15.2 to 0.15.3
@@ -624,4 +624,12 @@ (function(module, ns) { | ||
var modifiedTest = test; | ||
if (test.length === 0) { | ||
// Give me a callback! | ||
modifiedTest = function(done) { | ||
done(null, test()); | ||
}; | ||
} | ||
return (sync ? this.waitForSync : this.waitForAsync).call( | ||
this, test, callback, interval, timeout); | ||
this, modifiedTest, callback, interval, timeout); | ||
}, | ||
@@ -639,7 +647,17 @@ | ||
waitForSync: function(test, callback, interval, timeout) { | ||
var err, result; | ||
while (Date.now() < timeout) { | ||
if (test()) { | ||
return callback(null); | ||
if (err) { | ||
throw err; | ||
} | ||
if (result) { | ||
return callback(); | ||
} | ||
test(function(_err, _result) { | ||
err = _err; | ||
result = _result; | ||
}); | ||
this.executeAsyncScript(function(waitMillis) { | ||
@@ -650,3 +668,3 @@ setTimeout(marionetteScriptFinished, waitMillis); | ||
callback(new Error('timeout exceeded')); | ||
callback(new Error('timeout exceeded!')); | ||
}, | ||
@@ -668,22 +686,17 @@ | ||
var result, err; | ||
try { | ||
result = test(); | ||
} catch (e) { | ||
err = e; | ||
} | ||
test(function(err, result) { | ||
if (err || result) { | ||
return callback(err, result); | ||
} | ||
if (result || err) { | ||
return callback(err || null); | ||
} | ||
var next = this.waitForAsync.bind( | ||
this, | ||
test, | ||
callback, | ||
interval, | ||
timeout | ||
); | ||
var next = this.waitForAsync.bind( | ||
this, | ||
test, | ||
callback, | ||
interval, | ||
timeout | ||
); | ||
setTimeout(next, interval); | ||
setTimeout(next, interval); | ||
}.bind(this)); | ||
}, | ||
@@ -741,2 +754,15 @@ | ||
/** | ||
* Returns the capabilities of the current session. | ||
* | ||
* @method sessionCapabilities | ||
* @param {Function} [callback] | ||
* executed with capabilities of current session. | ||
* @return {Object} A JSON representing capabilities. | ||
*/ | ||
sessionCapabilities: function sessionCapabilities(callback) { | ||
var cmd = { type: 'getSessionCapabilities' }; | ||
return this._sendCommand(cmd, 'value', callback); | ||
}, | ||
/** | ||
* Callback will receive the id of the current window. | ||
@@ -746,3 +772,3 @@ * | ||
* @method getWindow | ||
* @param {Function} callback executed with id of current window. | ||
* @param {Function} [callback] executed with id of current window. | ||
* @return {Object} self. | ||
@@ -758,5 +784,5 @@ */ | ||
* | ||
* @method getWindow | ||
* @method getWindows | ||
* @chainable | ||
* @param {Function} callback executes with an array of ids. | ||
* @param {Function} [callback] executes with an array of ids. | ||
*/ | ||
@@ -886,4 +912,12 @@ getWindows: function getWindows(callback) { | ||
/** | ||
* setSearchTimeout | ||
* Sets a timeout for the find methods. | ||
* | ||
* When searching for an element using either Marionette.findElement or | ||
* Marionette.findElements, the method will continue trying to locate the | ||
* element for up to timeout ms. | ||
* | ||
* This can be useful if, for example, the element you’re looking for might | ||
* not exist immediately, because it belongs to a page which is currently | ||
* being loaded. | ||
* | ||
* @method setSearchTimeout | ||
@@ -890,0 +924,0 @@ * @chainable |
{ | ||
"name": "marionette-client", | ||
"version": "0.15.2", | ||
"version": "0.15.3", | ||
"main": "lib/marionette/index", | ||
@@ -5,0 +5,0 @@ "description": "Marionette Javascript Client", |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
91092
2982
2