-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
88 lines (75 loc) · 2.16 KB
/
test.js
File metadata and controls
88 lines (75 loc) · 2.16 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/* global require, describe, it */
/**
* Simple app test using Appium. Requires wd, mocha and chai.
*/
var wd = require("wd"),
chai = require("chai"),
chaiAsPromised = require("chai-as-promised"),
colors = require('colors'),
path = require("path");
// setup chai - yawn
chai.use(chaiAsPromised);
chai.should();
chaiAsPromised.transferPromiseness = wd.transferPromiseness;
var appiumServer = {
host: "localhost",
port: 4723
};
// capabilities for iOS simulator
var capabilities = {
browserName: "",
autoWebview: true,
platformName: "iOS",
platformVersion: "9.0",
//deviceName: "iPhone Simulator",
deviceName: 'iPhone 6s',
app: path.resolve("platforms/ios/build/emulator/appiumone.app")
};
// a simple test suite
describe("Appium app", function () {
var browser;
// set a nice long timeout so Appium can do it's thing
this.timeout(120000);
// setup wd session
before(function(done) {
browser = wd.promiseChainRemote(appiumServer);
browser.on('status', function(info) {
console.log(info.cyan);
});
browser.on('command', function(eventType, command, response) {
console.log(' > ' + eventType.cyan, command, (response || '').grey);
});
browser.on('http', function(meth, path, data) {
console.log(' > ' + meth.magenta, path, (data || '').grey);
});
browser
.init(capabilities)
.then(function() { done(); });
});
// test a very simple property of the app
it("should have title 'Dashboard'", function (done) {
browser
.elementByCss(".title")
.getValue().should.become("Dashboard")
.then(function() { done(); });
});
// a more exciting test
//it("should have some tabs", function (done) {
// browser
// .elementByCss("a[icon~=ion-heart]")
// .click()
// .elementByCss(".title")
// .getValue().should.become("Friends")
// .elementByCss("a[icon~=ion-gear-b]")
// .click()
// .elementByCss(".title")
// .getValue().should.become("Account")
// .then(function() { done(); });
//});
// kill session after tests have run
after(function(done) {
browser
.quit()
.then(function() { done(); });
});
});