macaca-android
Advanced tools
Comparing version 1.1.13 to 1.1.14
@@ -14,2 +14,6 @@ 'use strict'; | ||
controllers.isWebContext = function() { | ||
return this.context != null && this.context !== NATIVE; | ||
}; | ||
controllers.getContext = function *() { | ||
@@ -200,10 +204,32 @@ return this.context; | ||
} | ||
return yield this.send({ | ||
cmd: 'actions', | ||
args: { | ||
actions: actions | ||
} | ||
}); | ||
if (this.isWebContext()) { | ||
const futureActions = actions.map(action => { | ||
const actionDelegate = this[action.type]; | ||
if (actionDelegate) { | ||
return actionDelegate.bind(this, action); | ||
} else { | ||
return () => { | ||
throw new errors.NotImplementedError(`Action ${action.type} is not implemented yet.`); | ||
} | ||
} | ||
}); | ||
return yield _.serialTasks.apply(null, futureActions); | ||
} else { | ||
return yield this.send({ | ||
cmd: 'actions', | ||
args: { | ||
actions: actions | ||
} | ||
}); | ||
} | ||
}; | ||
controllers.tap = function(action) { | ||
return this | ||
.proxyCommand('/wd/hub/session/temp/touch/click', 'POST', { element: action.element }) | ||
.then(result => { | ||
return _.parseWebDriverResult(result); | ||
}); | ||
} | ||
controllers.acceptAlert = function *() { | ||
@@ -210,0 +236,0 @@ return yield this.send({ |
@@ -30,2 +30,7 @@ 'use strict'; | ||
_.serialTasks = function () { | ||
return Array.prototype.slice.call(arguments).reduce( | ||
(pre, task) => pre.then(() => task()), Promise.resolve()); | ||
}; | ||
_.waitForCondition = function(func, wait/*ms*/, interval/*ms*/) { | ||
@@ -32,0 +37,0 @@ wait = wait || 5000; |
{ | ||
"name": "macaca-android", | ||
"version": "1.1.13", | ||
"version": "1.1.14", | ||
"description": "Macaca Android driver", | ||
@@ -21,3 +21,3 @@ "keywords": [ | ||
"temp": "~0.8.3", | ||
"uiautomator-client": "1.0.42", | ||
"uiautomator-client": "1.0.43", | ||
"unlock-apk": "~0.1.11", | ||
@@ -24,0 +24,0 @@ "webdriver-dfn-error-code": "~1.0.1", |
20200
588
+ Addeduiautomator-client@1.0.43(transitive)
- Removeduiautomator-client@1.0.42(transitive)
Updateduiautomator-client@1.0.43