mirror of
https://github.com/appium/appium.git
synced 2026-02-10 03:38:49 -06:00
use node-style callbacks and fix undefined logic
This commit is contained in:
@@ -10,14 +10,14 @@ var iOSHybrid = {};
|
||||
|
||||
iOSHybrid.closeAlertBeforeTest = function (cb) {
|
||||
this.proxy("au.alertIsPresent()", function (err, res) {
|
||||
if (!err && res !== null && typeof res.value !== "undefined" && res.value === true) {
|
||||
if (!err && res !== null && typeof res !== "undefined" && res.value === true) {
|
||||
logger.debug("Alert present before starting test, let's banish it");
|
||||
this.proxy("au.dismissAlert()", function () {
|
||||
logger.debug("Alert banished!");
|
||||
cb(true);
|
||||
cb(null, true);
|
||||
});
|
||||
} else {
|
||||
cb(false);
|
||||
cb(null, false);
|
||||
}
|
||||
}.bind(this));
|
||||
};
|
||||
@@ -69,7 +69,7 @@ iOSHybrid.listWebFrames = function (cb, exitCb) {
|
||||
var loopClose = function () {
|
||||
loopCloseRuns++;
|
||||
if (!isDone && loopCloseRuns < 3) {
|
||||
this.closeAlertBeforeTest(function (didDismiss) {
|
||||
this.closeAlertBeforeTest(function (err, didDismiss) {
|
||||
if (!didDismiss) {
|
||||
setTimeout(loopClose, 1000);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user