@appium/fake-driver 5.1.3 → 5.1.5
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/build/lib/commands/alert.d.ts +58 -310
- package/build/lib/commands/alert.d.ts.map +1 -1
- package/build/lib/commands/alert.js +58 -69
- package/build/lib/commands/alert.js.map +1 -1
- package/build/lib/commands/contexts.d.ts +81 -330
- package/build/lib/commands/contexts.d.ts.map +1 -1
- package/build/lib/commands/contexts.js +75 -84
- package/build/lib/commands/contexts.js.map +1 -1
- package/build/lib/commands/element.d.ts +146 -315
- package/build/lib/commands/element.d.ts.map +1 -1
- package/build/lib/commands/element.js +134 -98
- package/build/lib/commands/element.js.map +1 -1
- package/build/lib/commands/find.d.ts +83 -327
- package/build/lib/commands/find.d.ts.map +1 -1
- package/build/lib/commands/find.js +93 -97
- package/build/lib/commands/find.js.map +1 -1
- package/build/lib/commands/general.d.ts +174 -332
- package/build/lib/commands/general.d.ts.map +1 -1
- package/build/lib/commands/general.js +119 -90
- package/build/lib/commands/general.js.map +1 -1
- package/build/lib/commands/index.d.ts +5 -1523
- package/build/lib/commands/index.d.ts.map +1 -1
- package/build/lib/commands/index.js +14 -14
- package/build/lib/commands/index.js.map +1 -1
- package/build/lib/driver.d.ts +80 -15
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/driver.js +74 -24
- package/build/lib/driver.js.map +1 -1
- package/build/lib/types.d.ts +1 -24
- package/build/lib/types.d.ts.map +1 -1
- package/lib/commands/alert.js +58 -67
- package/lib/commands/contexts.js +72 -81
- package/lib/commands/element.js +135 -94
- package/lib/commands/find.js +94 -98
- package/lib/commands/general.js +119 -91
- package/lib/commands/index.js +5 -13
- package/lib/driver.js +76 -20
- package/lib/types.ts +1 -29
- package/package.json +4 -3
- package/build/tsconfig.tsbuildinfo +0 -1
|
@@ -1,102 +1,131 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GeneralMixin = void 0;
|
|
4
3
|
const driver_1 = require("appium/driver");
|
|
5
4
|
const ORIENTATIONS = new Set(['LANDSCAPE', 'PORTRAIT']);
|
|
6
|
-
|
|
7
|
-
* @template {Class<import('../types').IContextsCommands & import('../types').IElementCommands>} T
|
|
8
|
-
* @param {T} Base
|
|
9
|
-
*/
|
|
10
|
-
function GeneralMixin(Base) {
|
|
5
|
+
exports.default = {
|
|
11
6
|
/**
|
|
12
|
-
* @
|
|
7
|
+
* @this {FakeDriver}
|
|
13
8
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
async setGeoLocation(location) {
|
|
26
|
-
// TODO test this adequately once WD bug is fixed
|
|
27
|
-
this.appModel.lat = location.latitude;
|
|
28
|
-
this.appModel.long = location.longitude;
|
|
29
|
-
}
|
|
30
|
-
async getGeoLocation() {
|
|
31
|
-
return this.appModel.currentGeoLocation;
|
|
32
|
-
}
|
|
33
|
-
async getPageSource() {
|
|
34
|
-
return this.appModel.rawXml;
|
|
35
|
-
}
|
|
36
|
-
async getOrientation() {
|
|
37
|
-
return this.appModel.orientation;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
*
|
|
41
|
-
* @param {import('../types').FakeDriverCaps['orientation']} o
|
|
42
|
-
*/
|
|
43
|
-
async setOrientation(o) {
|
|
44
|
-
if (!ORIENTATIONS.has(o)) {
|
|
45
|
-
throw new driver_1.errors.UnknownError('Orientation must be LANDSCAPE or PORTRAIT');
|
|
46
|
-
}
|
|
47
|
-
this.appModel.orientation = o;
|
|
48
|
-
}
|
|
49
|
-
async getScreenshot() {
|
|
50
|
-
return this.appModel.getScreenshot();
|
|
51
|
-
}
|
|
52
|
-
async getWindowSize() {
|
|
53
|
-
return { width: this.appModel.width, height: this.appModel.height };
|
|
54
|
-
}
|
|
55
|
-
async getWindowRect() {
|
|
56
|
-
return { width: this.appModel.width, height: this.appModel.height, x: 0, y: 0 };
|
|
57
|
-
}
|
|
58
|
-
async performActions(actions) {
|
|
59
|
-
this.appModel.actionLog.push(actions);
|
|
60
|
-
}
|
|
61
|
-
async releaseActions() { }
|
|
62
|
-
async getLog(type) {
|
|
63
|
-
switch (type) {
|
|
64
|
-
case 'actions':
|
|
65
|
-
return this.appModel.actionLog;
|
|
66
|
-
default:
|
|
67
|
-
throw new Error(`Don't understand log type '${type}'`);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
async mobileShake() {
|
|
71
|
-
this.shook = true;
|
|
9
|
+
async title() {
|
|
10
|
+
this.assertWebviewContext();
|
|
11
|
+
return this.appModel.title;
|
|
12
|
+
},
|
|
13
|
+
/**
|
|
14
|
+
* @this {FakeDriver}
|
|
15
|
+
*/
|
|
16
|
+
async keys(value) {
|
|
17
|
+
if (!this.focusedElId) {
|
|
18
|
+
throw new driver_1.errors.InvalidElementStateError();
|
|
72
19
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
20
|
+
await this.setValue(value, this.focusedElId);
|
|
21
|
+
},
|
|
22
|
+
/**
|
|
23
|
+
* @this {FakeDriver}
|
|
24
|
+
*/
|
|
25
|
+
async setGeoLocation(location) {
|
|
26
|
+
// TODO test this adequately once WD bug is fixed
|
|
27
|
+
this.appModel.lat = location.latitude;
|
|
28
|
+
this.appModel.long = location.longitude;
|
|
29
|
+
},
|
|
30
|
+
/**
|
|
31
|
+
* @this {FakeDriver}
|
|
32
|
+
*/
|
|
33
|
+
async getGeoLocation() {
|
|
34
|
+
return this.appModel.currentGeoLocation;
|
|
35
|
+
},
|
|
36
|
+
/**
|
|
37
|
+
* @this {FakeDriver}
|
|
38
|
+
*/
|
|
39
|
+
async getPageSource() {
|
|
40
|
+
return this.appModel.rawXml;
|
|
41
|
+
},
|
|
42
|
+
/**
|
|
43
|
+
* @this {FakeDriver}
|
|
44
|
+
*/
|
|
45
|
+
async getOrientation() {
|
|
46
|
+
return this.appModel.orientation;
|
|
47
|
+
},
|
|
48
|
+
/**
|
|
49
|
+
*
|
|
50
|
+
* @param {import('../types').FakeDriverCaps['orientation']} o
|
|
51
|
+
* @this {FakeDriver}
|
|
52
|
+
*/
|
|
53
|
+
async setOrientation(o) {
|
|
54
|
+
if (!ORIENTATIONS.has(o)) {
|
|
55
|
+
throw new driver_1.errors.UnknownError('Orientation must be LANDSCAPE or PORTRAIT');
|
|
76
56
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
57
|
+
this.appModel.orientation = o;
|
|
58
|
+
},
|
|
59
|
+
/**
|
|
60
|
+
* @this {FakeDriver}
|
|
61
|
+
*/
|
|
62
|
+
async getScreenshot() {
|
|
63
|
+
return this.appModel.getScreenshot();
|
|
64
|
+
},
|
|
65
|
+
/**
|
|
66
|
+
* @this {FakeDriver}
|
|
67
|
+
*/
|
|
68
|
+
async getWindowSize() {
|
|
69
|
+
return { width: this.appModel.width, height: this.appModel.height };
|
|
70
|
+
},
|
|
71
|
+
/**
|
|
72
|
+
* @this {FakeDriver}
|
|
73
|
+
*/
|
|
74
|
+
async getWindowRect() {
|
|
75
|
+
return { width: this.appModel.width, height: this.appModel.height, x: 0, y: 0 };
|
|
76
|
+
},
|
|
77
|
+
/**
|
|
78
|
+
*
|
|
79
|
+
* @this {FakeDriver}
|
|
80
|
+
*/
|
|
81
|
+
async performActions(actions) {
|
|
82
|
+
this.appModel.actionLog.push(actions);
|
|
83
|
+
},
|
|
84
|
+
/**
|
|
85
|
+
* @this {FakeDriver}
|
|
86
|
+
*/
|
|
87
|
+
async releaseActions() { },
|
|
88
|
+
/**
|
|
89
|
+
* @this {FakeDriver}
|
|
90
|
+
*/
|
|
91
|
+
async getLog(type) {
|
|
92
|
+
switch (type) {
|
|
93
|
+
case 'actions':
|
|
94
|
+
return this.appModel.actionLog;
|
|
95
|
+
default:
|
|
96
|
+
throw new Error(`Don't understand log type '${type}'`);
|
|
87
97
|
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
98
|
+
},
|
|
99
|
+
/**
|
|
100
|
+
* @this {FakeDriver}
|
|
101
|
+
*/
|
|
102
|
+
async mobileShake() {
|
|
103
|
+
this.shook = true;
|
|
104
|
+
},
|
|
105
|
+
/**
|
|
106
|
+
* @this {FakeDriver}
|
|
107
|
+
*/
|
|
108
|
+
async doubleClick() { },
|
|
109
|
+
/**
|
|
110
|
+
* @this {FakeDriver}
|
|
111
|
+
*/
|
|
112
|
+
async execute(script, args) {
|
|
113
|
+
return await this.executeMethod(script, args);
|
|
114
|
+
},
|
|
115
|
+
/**
|
|
116
|
+
* Add two or maybe even three numbers
|
|
117
|
+
*
|
|
118
|
+
* @param {number} num1
|
|
119
|
+
* @param {number} num2
|
|
120
|
+
* @param {number} [num3]
|
|
121
|
+
* @returns {Promise<number>}
|
|
122
|
+
* @this {FakeDriver}
|
|
123
|
+
*/
|
|
124
|
+
async fakeAddition(num1, num2, num3 = 0) {
|
|
125
|
+
return num1 + num2 + (num3 ?? 0);
|
|
126
|
+
},
|
|
127
|
+
};
|
|
99
128
|
/**
|
|
100
|
-
* @typedef {import('../
|
|
129
|
+
* @typedef {import('../driver').FakeDriver} FakeDriver
|
|
101
130
|
*/
|
|
102
131
|
//# sourceMappingURL=general.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"general.js","sourceRoot":"","sources":["../../../lib/commands/general.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"general.js","sourceRoot":"","sources":["../../../lib/commands/general.js"],"names":[],"mappings":";;AAAA,0CAAqC;AAErC,MAAM,YAAY,GAA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