forked from appium-boneyard/sample-code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathios-local-server.js
More file actions
59 lines (49 loc) · 1.54 KB
/
ios-local-server.js
File metadata and controls
59 lines (49 loc) · 1.54 KB
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
"use strict";
require("./helpers/setup");
var wd = require("wd"),
_ = require('underscore'),
serverConfigs = require('./helpers/appium-servers'),
localServer = require('./helpers/local-server');
describe("ios local server", function () {
this.timeout(300000);
var driver;
var allPassed = true;
before(function () {
localServer.start();
var serverConfig = process.env.SAUCE ?
serverConfigs.sauce : serverConfigs.local;
driver = wd.promiseChainRemote(serverConfig);
require("./helpers/logging").configure(driver);
var desired = _.clone(require("./helpers/caps").ios81);
desired.app = require("./helpers/apps").iosWebviewAppLocal;
if (process.env.SAUCE) {
desired.name = 'ios - local server';
desired.tags = ['sample'];
}
return driver.init(desired);
});
after(function () {
localServer.stop();
return driver
.quit()
.finally(function () {
if (process.env.SAUCE) {
return driver.sauceJobStatus(allPassed);
}
});
});
afterEach(function () {
allPassed = allPassed && this.currentTest.state === 'passed';
});
it("should get the url", function () {
return driver
.elementByXPath('//UIATextField[@value=\'Enter URL\']')
.sendKeys('http://localhost:3000/index.html')
.elementByName('Go').click()
.elementByClassName('UIAWebView').click() // dismissing keyboard
.context('WEBVIEW')
.sleep(3000)
.waitForElementById('wow')
.text().should.eventually.include('so cool');
});
});