Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var app = require("../../../server");
var PORT = process.env.FUNC_PORT || 3003;
var HOST = process.env.TEST_HOST || "http://127.0.0.1:" + PORT;
// WD helpers.
// https://github.com/admc/wd/blob/master/lib/special-keys.js
var wd = require("wd");
var ENTER_KEY = wd.SPECIAL_KEYS.Enter;
// Rowdy helpers and adapter.
var rowdy = require("rowdy");
var adapter = rowdy.adapters.mocha;
var helpers = rowdy.helpers;
describe("func/application", function () {
var client;
var server;
// --------------------------------------------------------------------------
// Mocha
// --------------------------------------------------------------------------
// Set a Mocha global timeout of 10 seconds to allow for test wonkiness.
this.timeout(10000);
it("should switch to webview", function () {
return driver
.elementByName('buttonStartWebviewCD')
.click()
.sleep(5000)
.contexts()
.then(function (ctxs) {
console.log(ctxs);
return driver.context(ctxs[ctxs.length - 1]);
})
.elementById('name_input')
.clear()
.sendKeys('Appium User')
.sendKeys(wd.SPECIAL_KEYS.Return)
.sleep(1000)
.source().then(function (source) {
source.should.include('This is my way of saying hello');
source.should.include('Appium User');
});
});
});
els[els.length - 1](function (err, el) {
if (err) return then(err);
el.type(wd.SPECIAL_KEYS.Tab, then);
});
});
if (typeof server === "undefined") {
server = 'ondemand.saucelabs.com';
} else if (server !== 'ondemand.saucelabs.com') {
apiHostname = server;
}
if (typeof port === "undefined") {
port = 80;
}
var d = yiewd.remote(server, port, userName, accessKey);
_setSauceCreds(d, userName, accessKey, apiHostname);
return d;
};
yiewd.TouchAction = wd.TouchAction;
yiewd.MultiAction = wd.MultiAction;
yiewd.SPECIAL_KEYS = wd.SPECIAL_KEYS;