Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
197 lines (183 loc) · 5.76 KB

File metadata and controls

197 lines (183 loc) · 5.76 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
"use strict";
require("./helpers/setup");
var wd = require("wd"),
_ = require('underscore'),
actions = require("./helpers/actions"),
serverConfigs = require('./helpers/appium-servers'),
_p = require('./helpers/promise-utils'),
Q = require('q');
wd.addPromiseChainMethod('swipe', actions.swipe);
describe("android complex", function () {
this.timeout(300000);
var driver;
var allPassed = true;
before(function () {
var serverConfig = process.env.SAUCE ?
serverConfigs.sauce : serverConfigs.local;
driver = wd.promiseChainRemote(serverConfig);
require("./helpers/logging").configure(driver);
var desired = process.env.SAUCE ?
_.clone(require("./helpers/caps").android18) :
_.clone(require("./helpers/caps").android19);
desired.app = require("./helpers/apps").androidApiDemos;
if (process.env.SAUCE) {
desired.name = 'android - complex';
desired.tags = ['sample'];
}
return driver
.init(desired)
.setImplicitWaitTimeout(5000);
});
after(function () {
return driver
.quit()
.finally(function () {
if (process.env.SAUCE) {
return driver.sauceJobStatus(allPassed);
}
});
});
afterEach(function () {
allPassed = allPassed && this.currentTest.state === 'passed';
});
it("should find an element", function () {
return driver
.elementByXPath('//android.widget.TextView[@text=\'Animation\']')
.elementByXPath('//android.widget.TextView')
.text().should.become('API Demos')
.elementsByXPath('//android.widget.TextView[contains(@text, "Animat")]')
.then(_p.filterDisplayed).first()
.then(function (el) {
if (!process.env.SAUCE) {
return el.text().should.become('Animation');
}
}).elementByName('App').click()
.sleep(3000)
.elementsByAndroidUIAutomator('new UiSelector().clickable(true)')
.should.eventually.have.length.above(10)
.elementByXPath('//android.widget.TextView[@text=\'Action Bar\']')
.should.eventually.exist
.elementsByXPath('//android.widget.TextView')
.then(_p.filterDisplayed).first()
.text().should.become('API Demos')
.back().sleep(1000);
});
it("should scroll", function () {
return driver
.elementByXPath('//android.widget.TextView[@text=\'Animation\']')
.elementsByXPath('//android.widget.TextView')
.then(function (els) {
return Q.all([
els[7].getLocation(),
els[3].getLocation()
]).then(function (locs) {
console.log('locs -->', locs);
return driver.swipe({
startX: locs[0].x, startY: locs[0].y,
endX: locs[1].x, endY: locs[1].y,
duration: 800
});
});
});
});
it("should draw a smiley", function () {
function findTouchPaint() {
return driver
.elementsByClassName('android.widget.TextView')
.then(function (els) {
return Q.all([
els[els.length - 1].getLocation(),
els[0].getLocation()
]).then(function (locs) {
return driver.swipe({
startX: locs[0].x, startY: locs[0].y,
endX: locs[1].x, endY: locs[1].y,
duration: 800
});
});
}).elementByName('Touch Paint')
.catch(function () {
return findTouchPaint();
});
}
return driver
.elementByName('Graphics').click()
.then(findTouchPaint)
.click()
.sleep(5000)
.then(function () {
var a1 = new wd.TouchAction();
a1.press({x: 150, y: 100}).release();
var a2 = new wd.TouchAction();
a2.press({x: 250, y: 100}).release();
var smile = new wd.TouchAction();
smile
.press({x:110, y:200})
.moveTo({x:1, y:1})
.moveTo({x:1, y:1})
.moveTo({x:1, y:1})
.moveTo({x:1, y:1})
.moveTo({x:1, y:1})
.moveTo({x:2, y:1})
.moveTo({x:2, y:1})
.moveTo({x:2, y:1})
.moveTo({x:2, y:1})
.moveTo({x:2, y:1})
.moveTo({x:3, y:1})
.moveTo({x:3, y:1})
.moveTo({x:3, y:1})
.moveTo({x:3, y:1})
.moveTo({x:3, y:1})
.moveTo({x:4, y:1})
.moveTo({x:4, y:1})
.moveTo({x:4, y:1})
.moveTo({x:4, y:1})
.moveTo({x:4, y:1})
.moveTo({x:5, y:1})
.moveTo({x:5, y:1})
.moveTo({x:5, y:1})
.moveTo({x:5, y:1})
.moveTo({x:5, y:1})
.moveTo({x:5, y:0})
.moveTo({x:5, y:0})
.moveTo({x:5, y:0})
.moveTo({x:5, y:0})
.moveTo({x:5, y:0})
.moveTo({x:5, y:0})
.moveTo({x:5, y:0})
.moveTo({x:5, y:0})
.moveTo({x:5, y:-1})
.moveTo({x:5, y:-1})
.moveTo({x:5, y:-1})
.moveTo({x:5, y:-1})
.moveTo({x:5, y:-1})
.moveTo({x:4, y:-1})
.moveTo({x:4, y:-1})
.moveTo({x:4, y:-1})
.moveTo({x:4, y:-1})
.moveTo({x:4, y:-1})
.moveTo({x:3, y:-1})
.moveTo({x:3, y:-1})
.moveTo({x:3, y:-1})
.moveTo({x:3, y:-1})
.moveTo({x:3, y:-1})
.moveTo({x:2, y:-1})
.moveTo({x:2, y:-1})
.moveTo({x:2, y:-1})
.moveTo({x:2, y:-1})
.moveTo({x:2, y:-1})
.moveTo({x:1, y:-1})
.moveTo({x:1, y:-1})
.moveTo({x:1, y:-1})
.moveTo({x:1, y:-1})
.moveTo({x:1, y:-1})
.release();
var ma = new wd.MultiAction().add(a1, a2, smile);
return driver.performMultiAction(ma)
// so you can see it
.sleep(10000)
.back().sleep(1000)
.back().sleep(1000);
});
});
});
Morty Proxy This is a proxified and sanitized view of the page, visit original site.