bump selendroid to 0.13.0 with a few concomitant fixes

This commit is contained in:
Jonathan Lipps 2015-01-15 14:31:35 -08:00
Родитель bc952b28b8
Коммит ffbf872b01
5 изменённых файлов: 31 добавлений и 14 удалений

Просмотреть файл

@ -194,7 +194,7 @@ Selendroid.prototype.start = function (cb) {
Selendroid.prototype.pushSelendroid = function (cb) {
var instrumentWith = this.args.appPackage + ".selendroid/" +
"io.selendroid.ServerInstrumentation";
"io.selendroid.server.ServerInstrumentation";
this.adb.instrument(this.args.appPackage, this.args.appActivity, instrumentWith, cb);
};

@ -1 +1 @@
Subproject commit 9b7fff26770f2ee4f059c640bfe88419c3c07e23
Subproject commit ec84567bb60cb2f47936aa4213be7ff537d2e596

Просмотреть файл

@ -178,7 +178,9 @@ module.exports = function () {
});
describe('pressing device key with unicode keyboard', function () {
it('should be able to send combination keyevents', function (done) {
// skip selendroid because selendroid implements keyevent with an adb
// call, and we are unable to send metastate that way
it('should be able to send combination keyevents @skip-selendroid-all', function (done) {
driver
.waitForElementByClassName('android.widget.EditText')
.clear()

Просмотреть файл

@ -21,11 +21,7 @@ module.exports = function () {
before(function (done) {
driver
.waitForElementByClassName('android.webkit.WebView')
.contexts()
.then(function (ctxs) {
ctxs.should.have.length(2);
return driver.context(ctxs[ctxs.length - 1]);
})
.firstWebContext()
.nodeify(done);
});
@ -35,8 +31,7 @@ module.exports = function () {
.nodeify(done);
});
// skip until Selendroid implements context methods
it('should raise NoSuchContext (status: 35) @skip-selendroid-all', function (done) {
it('should raise NoSuchContext (status: 35)', function (done) {
driver
.context('WEBVIEW_42')
.should.be.rejectedWith(/status: 35/)
@ -96,10 +91,7 @@ module.exports = function () {
.elementById('i_am_a_textbox')
.should.be.rejectedWith("status: 7")
// go back into the webview
.contexts()
.then(function (ctxs) {
return driver.context(ctxs[ctxs.length - 1]);
})
.firstWebContext()
// should find the element in the web context
.elementById('i_am_a_textbox')
.should.not.be.rejected

Просмотреть файл

@ -58,6 +58,29 @@ module.exports.initSession = function (desired, opts) {
return this.source().then(function (s) { console.log(s); });
});
wd.addPromiseChainMethod('firstWebContext', function (assertCtxLength) {
var d = this;
return d
.contexts()
.then(function (ctxs) {
if (!_.isUndefined(assertCtxLength) && ctxs.length !== assertCtxLength) {
throw new Error("Expected " + assertCtxLength + " contexts but got " +
ctxs.length);
}
var context = null;
for (var i = 0; i < ctxs.length; i++) {
if (ctxs[i].indexOf('NATIVE') === -1) {
context = ctxs[i];
}
}
if (context === null) {
throw new Error("Could not find any web contexts. Contexts were: " +
JSON.stringify(ctxs));
}
return d.context(context);
});
});
return {
setUp: function (name) {
if (env.VERBOSE) {