diff --git a/test/functional/android/webview-specs.js b/test/functional/android/webview-specs.js index 1de90adf0..cbb35c084 100644 --- a/test/functional/android/webview-specs.js +++ b/test/functional/android/webview-specs.js @@ -4,6 +4,4 @@ var androidWebviewTests = require('../common/android-webview-base'); // TODO: androidWebviewTests is using an app built by selendroid. Need to build it once // and save it into asset so that it can be used by android tests -// TODO: when I run it on android I don't see the WEBVIEW context, this needs -// to be investigated describe('android - web_view @skip-ci @skip-android-all', androidWebviewTests); diff --git a/test/functional/common/android-webview-base.js b/test/functional/common/android-webview-base.js index 430ce9024..dfb63ffd9 100644 --- a/test/functional/common/android-webview-base.js +++ b/test/functional/common/android-webview-base.js @@ -2,7 +2,8 @@ "use strict"; var env = require('../../helpers/env') - , setup = require("./setup-base"); + , setup = require("./setup-base") + , Asserter = require('wd').Asserter; var desired = { app: "sample-code/apps/selendroid-test-app.apk", @@ -14,10 +15,17 @@ module.exports = function () { var driver; setup(this, desired).then(function (d) { driver = d; }); + var webviewContextAvailable = new Asserter( + function (driver) { + return driver + .contexts().should.eventually.have.length(2); + } + ); + beforeEach(function (done) { driver .waitForElementByName('buttonStartWebviewCD').click() - .sleep(500) + .waitFor(webviewContextAvailable, 1000, 100) .context('WEBVIEW') .nodeify(done); });