@appium/fake-driver 5.2.0 → 5.2.1

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 (65) hide show
  1. package/LICENSE +1 -1
  2. package/build/lib/commands/alert.d.ts +12 -40
  3. package/build/lib/commands/alert.d.ts.map +1 -1
  4. package/build/lib/commands/alert.js +3 -23
  5. package/build/lib/commands/alert.js.map +1 -1
  6. package/build/lib/commands/contexts.d.ts +12 -42
  7. package/build/lib/commands/contexts.d.ts.map +1 -1
  8. package/build/lib/commands/contexts.js +8 -28
  9. package/build/lib/commands/contexts.js.map +1 -1
  10. package/build/lib/commands/element.d.ts +25 -74
  11. package/build/lib/commands/element.d.ts.map +1 -1
  12. package/build/lib/commands/element.js +24 -76
  13. package/build/lib/commands/element.js.map +1 -1
  14. package/build/lib/commands/find.d.ts +16 -44
  15. package/build/lib/commands/find.d.ts.map +1 -1
  16. package/build/lib/commands/find.js +21 -45
  17. package/build/lib/commands/find.js.map +1 -1
  18. package/build/lib/commands/general.d.ts +25 -88
  19. package/build/lib/commands/general.d.ts.map +1 -1
  20. package/build/lib/commands/general.js +3 -61
  21. package/build/lib/commands/general.js.map +1 -1
  22. package/build/lib/commands/index.d.ts +13 -5
  23. package/build/lib/commands/index.d.ts.map +1 -1
  24. package/build/lib/commands/index.js +26 -13
  25. package/build/lib/commands/index.js.map +1 -1
  26. package/build/lib/commands/mixin.d.ts +11 -0
  27. package/build/lib/commands/mixin.d.ts.map +1 -0
  28. package/build/lib/commands/mixin.js +17 -0
  29. package/build/lib/commands/mixin.js.map +1 -0
  30. package/build/lib/driver.d.ts +37 -92
  31. package/build/lib/driver.d.ts.map +1 -1
  32. package/build/lib/driver.js +26 -73
  33. package/build/lib/driver.js.map +1 -1
  34. package/build/lib/fake-app.d.ts +9 -7
  35. package/build/lib/fake-app.d.ts.map +1 -1
  36. package/build/lib/fake-app.js +2 -0
  37. package/build/lib/fake-app.js.map +1 -1
  38. package/build/lib/fake-element.d.ts +12 -4
  39. package/build/lib/fake-element.d.ts.map +1 -1
  40. package/build/lib/fake-element.js +11 -4
  41. package/build/lib/fake-element.js.map +1 -1
  42. package/build/lib/scripts/fake-error.d.ts +1 -0
  43. package/build/lib/scripts/fake-error.js +11 -1
  44. package/build/lib/scripts/fake-error.js.map +1 -1
  45. package/build/lib/scripts/fake-stdin.d.ts +2 -0
  46. package/build/lib/scripts/fake-stdin.d.ts.map +1 -0
  47. package/build/lib/scripts/fake-stdin.js +13 -0
  48. package/build/lib/scripts/fake-stdin.js.map +1 -0
  49. package/lib/commands/alert.ts +70 -0
  50. package/lib/commands/{contexts.js → contexts.ts} +26 -34
  51. package/lib/commands/element.ts +138 -0
  52. package/lib/commands/find.ts +137 -0
  53. package/lib/commands/general.ts +115 -0
  54. package/lib/commands/{index.js → index.ts} +14 -5
  55. package/lib/commands/mixin.ts +13 -0
  56. package/lib/driver.js +42 -78
  57. package/lib/fake-app.js +3 -3
  58. package/lib/fake-element.js +21 -6
  59. package/lib/scripts/fake-error.js +8 -1
  60. package/lib/scripts/fake-stdin.js +9 -0
  61. package/package.json +4 -3
  62. package/lib/commands/alert.js +0 -73
  63. package/lib/commands/element.js +0 -161
  64. package/lib/commands/find.js +0 -118
  65. package/lib/commands/general.js +0 -147
@@ -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
- */