@appium/fake-driver 5.1.3 → 5.1.4

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.
Files changed (40) hide show
  1. package/build/lib/commands/alert.d.ts +58 -310
  2. package/build/lib/commands/alert.d.ts.map +1 -1
  3. package/build/lib/commands/alert.js +58 -69
  4. package/build/lib/commands/alert.js.map +1 -1
  5. package/build/lib/commands/contexts.d.ts +81 -330
  6. package/build/lib/commands/contexts.d.ts.map +1 -1
  7. package/build/lib/commands/contexts.js +75 -84
  8. package/build/lib/commands/contexts.js.map +1 -1
  9. package/build/lib/commands/element.d.ts +146 -315
  10. package/build/lib/commands/element.d.ts.map +1 -1
  11. package/build/lib/commands/element.js +134 -98
  12. package/build/lib/commands/element.js.map +1 -1
  13. package/build/lib/commands/find.d.ts +83 -327
  14. package/build/lib/commands/find.d.ts.map +1 -1
  15. package/build/lib/commands/find.js +93 -97
  16. package/build/lib/commands/find.js.map +1 -1
  17. package/build/lib/commands/general.d.ts +174 -332
  18. package/build/lib/commands/general.d.ts.map +1 -1
  19. package/build/lib/commands/general.js +119 -90
  20. package/build/lib/commands/general.js.map +1 -1
  21. package/build/lib/commands/index.d.ts +5 -1523
  22. package/build/lib/commands/index.d.ts.map +1 -1
  23. package/build/lib/commands/index.js +14 -14
  24. package/build/lib/commands/index.js.map +1 -1
  25. package/build/lib/driver.d.ts +80 -15
  26. package/build/lib/driver.d.ts.map +1 -1
  27. package/build/lib/driver.js +74 -24
  28. package/build/lib/driver.js.map +1 -1
  29. package/build/lib/types.d.ts +1 -24
  30. package/build/lib/types.d.ts.map +1 -1
  31. package/build/tsconfig.tsbuildinfo +1 -1
  32. package/lib/commands/alert.js +58 -67
  33. package/lib/commands/contexts.js +72 -81
  34. package/lib/commands/element.js +135 -94
  35. package/lib/commands/find.js +94 -98
  36. package/lib/commands/general.js +119 -91
  37. package/lib/commands/index.js +5 -13
  38. package/lib/driver.js +76 -20
  39. package/lib/types.ts +1 -29
  40. package/package.json +2 -2
@@ -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
- * @implements {IGeneralCommands}
7
+ * @this {FakeDriver}
13
8
  */
14
- class GeneralCommands extends Base {
15
- async title() {
16
- this.assertWebviewContext();
17
- return this.appModel.title;
18
- }
19
- async keys(value) {
20
- if (!this.focusedElId) {
21
- throw new driver_1.errors.InvalidElementStateError();
22
- }
23
- await this.setValue(value, this.focusedElId);
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
- async doubleClick() { }
74
- async execute(script, args) {
75
- return await this.executeMethod(script, args);
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
- * Add two or maybe even three numbers
79
- *
80
- * @param {number} num1
81
- * @param {number} num2
82
- * @param {number} [num3]
83
- * @returns {Promise<number>}
84
- */
85
- async fakeAddition(num1, num2, num3 = 0) {
86
- return num1 + num2 + (num3 ?? 0);
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
- return GeneralCommands;
90
- }
91
- exports.GeneralMixin = GeneralMixin;
92
- /**
93
- * @typedef {import('../driver').FakeDriverCore} FakeDriverCore
94
- */
95
- /**
96
- * @template T,[U={}],[V=Array<any>]
97
- * @typedef {import('@appium/types').Class<T,U,V>} Class
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('../types').IGeneralCommands} IGeneralCommands
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":";;;AAAA,0CAAqC;AAErC,MAAM,Y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