-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathandroid-webview.js
67 lines (59 loc) · 1.8 KB
/
android-webview.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
"use strict";
require("./helpers/setup");
var wd = require("wd"),
_ = require('underscore'),
serverConfigs = require('./helpers/appium-servers');
describe("android webview", function () {
this.timeout(300000);
var driver;
var allPassed = true;
before(function () {
var serverConfig = process.env.npm_package_config_sauce ?
serverConfigs.sauce : serverConfigs.local;
driver = wd.promiseChainRemote(serverConfig);
require("./helpers/logging").configure(driver);
var desired = process.env.npm_package_config_sauce ?
_.clone(require("./helpers/caps").android18) :
_.clone(require("./helpers/caps").android19);
desired.app = require("./helpers/apps").selendroidTestApp;
if (process.env.npm_package_config_sauce) {
desired.name = 'android - webview';
desired.tags = ['sample'];
}
return driver
.init(desired)
.setImplicitWaitTimeout(3000);
});
after(function () {
return driver
.quit()
.finally(function () {
if (process.env.npm_package_config_sauce) {
return driver.sauceJobStatus(allPassed);
}
});
});
afterEach(function () {
allPassed = allPassed && this.currentTest.state === 'passed';
});
it("should switch to webview", function () {
return driver
.elementById('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');
});
});
});