Merge pull request #2445 from imurchie/isaac-contexts-beta

Allow multiple calls to get contexts in iOS
This commit is contained in:
Jonathan Lipps
2014-05-01 10:47:13 -07:00
3 changed files with 65 additions and 0 deletions
@@ -0,0 +1,50 @@
"use strict";
var setup = require("../../common/setup-base"),
desired = require('./desired'),
unorm = require('unorm');
describe('testapp - context methods', function () {
var driver;
setup(this, desired).then(function (d) { driver = d; });
it('getting list multiple times should not crash appium', function (done) {
driver
.contexts().should.eventually.have.length(1)
.contexts().should.eventually.have.length(1)
.contexts().should.eventually.have.length(1)
.contexts().should.eventually.have.length(1)
.contexts().should.eventually.have.length(1)
.contexts().should.eventually.have.length(1)
.contexts().should.eventually.have.length(1)
.contexts().should.eventually.have.length(1)
.nodeify(done);
});
it('setting context to \'null\' should work', function (done) {
driver.contexts().then(function (ctxs) {
ctxs.length.should.be.equal(1);
return ctxs[0];
}).then(function (ctx) {
return driver.context(ctx);
})
.context(null)
.nodeify(done);
});
it('setting context to \'NATIVE_APP\' should work', function (done) {
driver.contexts().then(function (ctxs) {
ctxs.length.should.be.above(0);
return ctxs[0];
}).then(function (ctx) {
return driver.context(ctx);
})
.context('NATIVE_APP')
.nodeify(done);
});
it('setting context to non-existent context should return \'NoSuchContext\' (status: 35)', function (done) {
driver
.context("WEBVIEW_42")
.should.be.rejectedWith(/status: 35/)
.nodeify(done);
});
});
@@ -24,6 +24,17 @@ describe('webview - webview -', function () {
.contexts().should.eventually.have.length.above(0)
.nodeify(done);
});
it('getting list multiple times should not crash appium', function (done) {
driver
.contexts().should.eventually.have.length.above(1)
.contexts().should.eventually.have.length.above(1)
.contexts().should.eventually.have.length.above(1)
.contexts().should.eventually.have.length.above(1)
.contexts().should.eventually.have.length.above(1)
.contexts().should.eventually.have.length.above(1)
.contexts().should.eventually.have.length.above(1)
.nodeify(done);
});
it('contexts should be strings', function (done) {
driver.contexts().then(function (ctxs) {
ctxs.length.should.be.above(0);