@appium/fake-driver 5.2.0 → 5.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/build/lib/commands/alert.d.ts +12 -40
- package/build/lib/commands/alert.d.ts.map +1 -1
- package/build/lib/commands/alert.js +3 -23
- package/build/lib/commands/alert.js.map +1 -1
- package/build/lib/commands/contexts.d.ts +12 -42
- package/build/lib/commands/contexts.d.ts.map +1 -1
- package/build/lib/commands/contexts.js +8 -28
- package/build/lib/commands/contexts.js.map +1 -1
- package/build/lib/commands/element.d.ts +25 -74
- package/build/lib/commands/element.d.ts.map +1 -1
- package/build/lib/commands/element.js +24 -76
- package/build/lib/commands/element.js.map +1 -1
- package/build/lib/commands/find.d.ts +16 -44
- package/build/lib/commands/find.d.ts.map +1 -1
- package/build/lib/commands/find.js +21 -45
- package/build/lib/commands/find.js.map +1 -1
- package/build/lib/commands/general.d.ts +25 -88
- package/build/lib/commands/general.d.ts.map +1 -1
- package/build/lib/commands/general.js +3 -61
- package/build/lib/commands/general.js.map +1 -1
- package/build/lib/commands/index.d.ts +13 -5
- package/build/lib/commands/index.d.ts.map +1 -1
- package/build/lib/commands/index.js +13 -14
- package/build/lib/commands/index.js.map +1 -1
- package/build/lib/commands/mixin.d.ts +11 -0
- package/build/lib/commands/mixin.d.ts.map +1 -0
- package/build/lib/commands/mixin.js +17 -0
- package/build/lib/commands/mixin.js.map +1 -0
- package/build/lib/driver.d.ts +37 -111
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/driver.js +11 -73
- package/build/lib/driver.js.map +1 -1
- package/build/lib/fake-app.d.ts +9 -7
- package/build/lib/fake-app.d.ts.map +1 -1
- package/build/lib/fake-app.js +2 -0
- package/build/lib/fake-app.js.map +1 -1
- package/build/lib/fake-element.d.ts +12 -4
- package/build/lib/fake-element.d.ts.map +1 -1
- package/build/lib/fake-element.js +11 -4
- package/build/lib/fake-element.js.map +1 -1
- package/build/lib/scripts/fake-error.d.ts +1 -0
- package/build/lib/scripts/fake-error.js +11 -1
- package/build/lib/scripts/fake-error.js.map +1 -1
- package/build/lib/scripts/fake-stdin.d.ts +2 -0
- package/build/lib/scripts/fake-stdin.d.ts.map +1 -0
- package/build/lib/scripts/fake-stdin.js +13 -0
- package/build/lib/scripts/fake-stdin.js.map +1 -0
- package/lib/commands/alert.ts +70 -0
- package/lib/commands/{contexts.js → contexts.ts} +26 -34
- package/lib/commands/element.ts +138 -0
- package/lib/commands/find.ts +137 -0
- package/lib/commands/general.ts +115 -0
- package/lib/commands/{index.js → index.ts} +14 -5
- package/lib/commands/mixin.ts +13 -0
- package/lib/driver.js +41 -78
- package/lib/fake-app.js +3 -3
- package/lib/fake-element.js +21 -6
- package/lib/scripts/fake-error.js +8 -1
- package/lib/scripts/fake-stdin.js +9 -0
- package/package.json +4 -3
- package/lib/commands/alert.js +0 -73
- package/lib/commands/element.js +0 -161
- package/lib/commands/find.js +0 -118
- package/lib/commands/general.js +0 -147
package/lib/commands/general.js
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import {errors} from 'appium/driver';
|
|
2
|
-
|
|
3
|
-
const ORIENTATIONS = new Set(['LANDSCAPE', 'PORTRAIT']);
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
/**
|
|
7
|
-
* @this {FakeDriver}
|
|
8
|
-
*/
|
|
9
|
-
async title() {
|
|
10
|
-
this.assertWebviewContext();
|
|
11
|
-
return this.appModel.title;
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @this {FakeDriver}
|
|
16
|
-
*/
|
|
17
|
-
async keys(value) {
|
|
18
|
-
if (!this.focusedElId) {
|
|
19
|
-
throw new errors.InvalidElementStateError();
|
|
20
|
-
}
|
|
21
|
-
await this.setValue(value, this.focusedElId);
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* @this {FakeDriver}
|
|
26
|
-
*/
|
|
27
|
-
async setGeoLocation(location) {
|
|
28
|
-
// TODO test this adequately once WD bug is fixed
|
|
29
|
-
this.appModel.lat = location.latitude;
|
|
30
|
-
this.appModel.long = location.longitude;
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* @this {FakeDriver}
|
|
35
|
-
*/
|
|
36
|
-
async getGeoLocation() {
|
|
37
|
-
return this.appModel.currentGeoLocation;
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* @this {FakeDriver}
|
|
42
|
-
*/
|
|
43
|
-
async getPageSource() {
|
|
44
|
-
return this.appModel.rawXml;
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* @this {FakeDriver}
|
|
49
|
-
*/
|
|
50
|
-
async getOrientation() {
|
|
51
|
-
return this.appModel.orientation;
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
*
|
|
56
|
-
* @param {import('../types').FakeDriverCaps['orientation']} o
|
|
57
|
-
* @this {FakeDriver}
|
|
58
|
-
*/
|
|
59
|
-
async setOrientation(o) {
|
|
60
|
-
if (!ORIENTATIONS.has(o)) {
|
|
61
|
-
throw new errors.UnknownError('Orientation must be LANDSCAPE or PORTRAIT');
|
|
62
|
-
}
|
|
63
|
-
this.appModel.orientation = o;
|
|
64
|
-
},
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* @this {FakeDriver}
|
|
68
|
-
*/
|
|
69
|
-
async getScreenshot() {
|
|
70
|
-
return this.appModel.getScreenshot();
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* @this {FakeDriver}
|
|
75
|
-
*/
|
|
76
|
-
async getWindowSize() {
|
|
77
|
-
return {width: this.appModel.width, height: this.appModel.height};
|
|
78
|
-
},
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* @this {FakeDriver}
|
|
82
|
-
*/
|
|
83
|
-
async getWindowRect() {
|
|
84
|
-
return {width: this.appModel.width, height: this.appModel.height, x: 0, y: 0};
|
|
85
|
-
},
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
*
|
|
89
|
-
* @this {FakeDriver}
|
|
90
|
-
*/
|
|
91
|
-
async performActions(actions) {
|
|
92
|
-
this.appModel.actionLog.push(actions);
|
|
93
|
-
},
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* @this {FakeDriver}
|
|
97
|
-
*/
|
|
98
|
-
async releaseActions() {},
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* @this {FakeDriver}
|
|
102
|
-
*/
|
|
103
|
-
async getLog(type) {
|
|
104
|
-
switch (type) {
|
|
105
|
-
case 'actions':
|
|
106
|
-
return this.appModel.actionLog;
|
|
107
|
-
default:
|
|
108
|
-
throw new Error(`Don't understand log type '${type}'`);
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* @this {FakeDriver}
|
|
114
|
-
*/
|
|
115
|
-
async mobileShake() {
|
|
116
|
-
this.shook = true;
|
|
117
|
-
},
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* @this {FakeDriver}
|
|
121
|
-
*/
|
|
122
|
-
async doubleClick() {},
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* @this {FakeDriver}
|
|
126
|
-
*/
|
|
127
|
-
async execute(script, args) {
|
|
128
|
-
return await this.executeMethod(script, args);
|
|
129
|
-
},
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Add two or maybe even three numbers
|
|
133
|
-
*
|
|
134
|
-
* @param {number} num1
|
|
135
|
-
* @param {number} num2
|
|
136
|
-
* @param {number} [num3]
|
|
137
|
-
* @returns {Promise<number>}
|
|
138
|
-
* @this {FakeDriver}
|
|
139
|
-
*/
|
|
140
|
-
async fakeAddition(num1, num2, num3 = 0) {
|
|
141
|
-
return num1 + num2 + (num3 ?? 0);
|
|
142
|
-
},
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* @typedef {import('../driver').FakeDriver} FakeDriver
|
|
147
|
-
*/
|