appium-mac2-driver 3.3.1 → 3.3.3
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/CHANGELOG.md +12 -0
- package/build/lib/commands/bidi/models.d.ts +6 -0
- package/build/lib/commands/bidi/models.d.ts.map +1 -1
- package/build/lib/commands/bidi/models.js +6 -0
- package/build/lib/commands/bidi/models.js.map +1 -1
- package/build/lib/commands/bidi/types.d.ts +2 -2
- package/build/lib/commands/bidi/types.d.ts.map +1 -1
- package/build/lib/commands/execute.d.ts.map +1 -1
- package/build/lib/commands/execute.js +1 -5
- package/build/lib/commands/execute.js.map +1 -1
- package/build/lib/commands/gestures.d.ts.map +1 -1
- package/build/lib/commands/gestures.js +6 -7
- package/build/lib/commands/gestures.js.map +1 -1
- package/build/lib/commands/helpers.d.ts +9 -0
- package/build/lib/commands/helpers.d.ts.map +1 -1
- package/build/lib/commands/helpers.js +10 -5
- package/build/lib/commands/helpers.js.map +1 -1
- package/build/lib/commands/native-record-screen.d.ts +11 -11
- package/build/lib/commands/native-record-screen.d.ts.map +1 -1
- package/build/lib/commands/native-record-screen.js +6 -8
- package/build/lib/commands/native-record-screen.js.map +1 -1
- package/build/lib/commands/record-screen.d.ts.map +1 -1
- package/build/lib/commands/record-screen.js +15 -15
- package/build/lib/commands/record-screen.js.map +1 -1
- package/build/lib/doctor/optional-checks.d.ts +1 -1
- package/build/lib/doctor/optional-checks.d.ts.map +1 -1
- package/build/lib/doctor/optional-checks.js +1 -1
- package/build/lib/doctor/optional-checks.js.map +1 -1
- package/build/lib/doctor/required-checks.d.ts +1 -1
- package/build/lib/doctor/required-checks.d.ts.map +1 -1
- package/build/lib/doctor/required-checks.js +1 -1
- package/build/lib/doctor/required-checks.js.map +1 -1
- package/build/lib/driver.d.ts +18 -18
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/driver.js +51 -52
- package/build/lib/driver.js.map +1 -1
- package/build/lib/utils.d.ts +19 -8
- package/build/lib/utils.d.ts.map +1 -1
- package/build/lib/utils.js +48 -10
- package/build/lib/utils.js.map +1 -1
- package/build/lib/wda-mac.d.ts.map +1 -1
- package/build/lib/wda-mac.js +25 -24
- package/build/lib/wda-mac.js.map +1 -1
- package/lib/commands/bidi/models.ts +6 -0
- package/lib/commands/bidi/types.ts +2 -2
- package/lib/commands/execute.ts +1 -2
- package/lib/commands/gestures.ts +8 -4
- package/lib/commands/helpers.ts +10 -2
- package/lib/commands/native-record-screen.ts +19 -23
- package/lib/commands/record-screen.ts +17 -17
- package/lib/doctor/optional-checks.ts +2 -1
- package/lib/doctor/required-checks.ts +2 -1
- package/lib/driver.ts +79 -79
- package/lib/utils.ts +48 -7
- package/lib/wda-mac.ts +33 -32
- package/npm-shrinkwrap.json +118 -100
- package/package.json +1 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"required-checks.js","sourceRoot":"","sources":["../../../lib/doctor/required-checks.ts"],"names":[],"mappings":";;;AAAA,4CAAsC;AACtC,+CAAkC;AAClC,+CAAqD;AAErD,0BAAwB;AAExB,MAAa,UAAU;IACrB,GAAG,CAAgB;IAEnB,KAAK,CAAC,QAAQ;QACZ,IAAI,CAAC;YACH,MAAM,SAAS,GAAG,MAAM,IAAA,sBAAY,GAAE,CAAC;YACvC,OAAO,gBAAM,CAAC,EAAE,CAAC,0BAA0B,SAAS,GAAG,CAAC,CAAC;QAC3D,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,gBAAM,CAAC,GAAG,CAAE,GAAa,CAAC,OAAO,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC;IAED,KAAK,CAAC,GAAG;QACP,OAAO,oBAAoB,OAAO,CAAC,IAAI,gFAAgF,CAAC;IAC1H,CAAC;IAED,UAAU;QACR,OAAO,KAAK,CAAC;IACf,CAAC;IAED,UAAU;QACR,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAvBD,gCAuBC;AACY,QAAA,UAAU,GAAG,IAAI,UAAU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AC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,gBAAM,CAAC,GAAG,CACf,4BAA6B,GAAW,CAAC,MAAM,IAAK,GAAa,CAAC,OAAO,EAAE,CAC5E,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,aAAa,EAAE,CAAC;YACnB,OAAO,gBAAM,CAAC,GAAG,CAAC,2CAA2C,MAAM,aAAa,MAAM,EAAE,CAAC,CAAC;QAC5F,CAAC;QACD,MAAM,aAAa,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACrD,IAAI,aAAa,GAAG,eAAe,CAAC,iBAAiB,EAAE,CAAC;YACtD,OAAO,gBAAM,CAAC,GAAG,CACf,6BAA6B,aAAa,CAAC,CAAC,CAAC,+BAA+B;gBAC1E,QAAQ,eAAe,CAAC,iBAAiB,GAAG,CAC/C,CAAC;QACJ,CAAC;QACD,OAAO,gBAAM,CAAC,EAAE,CACd,4DAA4D;YAC1D,IAAI,aAAa,CAAC,CAAC,CAAC,OAAO,eAAe,CAAC,iBAAiB,GAAG,CAClE,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,GAAG;QACP,OAAO,WAAW,OAAO,CAAC,IAAI,IAAI,eAAe,CAAC,iBAAiB,iCAAiC,CAAC;IACvG,CAAC;IAED,UAAU;QACR,OAAO,KAAK,CAAC;IACf,CAAC;IAED,UAAU;QACR,OAAO,KAAK,CAAC;IACf,CAAC;;AA5CH,0CA6CC;AACY,QAAA,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC"}
|
package/build/lib/driver.d.ts
CHANGED
|
@@ -14,12 +14,8 @@ import * as screenshotCommands from './commands/screenshots';
|
|
|
14
14
|
import * as sourceCommands from './commands/source';
|
|
15
15
|
import * as clipboardCommands from './commands/clipboard';
|
|
16
16
|
import * as nativeScreenRecordingCommands from './commands/native-record-screen';
|
|
17
|
+
type W3CMac2DriverCaps = W3CDriverCaps<Mac2Constraints>;
|
|
17
18
|
export declare class Mac2Driver extends BaseDriver<Mac2Constraints, StringRecord> implements ExternalDriver<Mac2Constraints, string, StringRecord> {
|
|
18
|
-
private isProxyActive;
|
|
19
|
-
private _wda;
|
|
20
|
-
_videoChunksBroadcaster: nativeScreenRecordingCommands.NativeVideoChunksBroadcaster;
|
|
21
|
-
_screenRecorder: recordScreenCommands.ScreenRecorder | null;
|
|
22
|
-
proxyReqRes: (...args: any) => any;
|
|
23
19
|
static newMethodMap: {
|
|
24
20
|
readonly '/session/:sessionId/appium/start_recording_screen': {
|
|
25
21
|
readonly POST: {
|
|
@@ -231,18 +227,6 @@ export declare class Mac2Driver extends BaseDriver<Mac2Constraints, StringRecord
|
|
|
231
227
|
};
|
|
232
228
|
};
|
|
233
229
|
};
|
|
234
|
-
constructor(opts?: InitialOpts);
|
|
235
|
-
onSettingsUpdate(key: string, value: unknown): Promise<void>;
|
|
236
|
-
get wda(): WDAMacServer;
|
|
237
|
-
proxyActive(sessionId: string): boolean;
|
|
238
|
-
getProxyAvoidList(sessionId: string): RouteMatcher[];
|
|
239
|
-
canProxy(): boolean;
|
|
240
|
-
proxyCommand(url: string, method: HTTPMethod, body?: HTTPBody): Promise<any>;
|
|
241
|
-
getStatus(): Promise<any>;
|
|
242
|
-
getWindowRect(): Promise<any>;
|
|
243
|
-
createSession(w3cCaps1: W3CMac2DriverCaps, w3cCaps2?: W3CMac2DriverCaps, w3cCaps3?: W3CMac2DriverCaps, driverData?: DriverData[]): Promise<DefaultCreateSessionResult<Mac2Constraints>>;
|
|
244
|
-
deleteSession(): Promise<void>;
|
|
245
|
-
private resetState;
|
|
246
230
|
macosLaunchApp: typeof appManagemenetCommands.macosLaunchApp;
|
|
247
231
|
macosActivateApp: typeof appManagemenetCommands.macosActivateApp;
|
|
248
232
|
macosTerminateApp: typeof appManagemenetCommands.macosTerminateApp;
|
|
@@ -279,7 +263,23 @@ export declare class Mac2Driver extends BaseDriver<Mac2Constraints, StringRecord
|
|
|
279
263
|
macosListDisplays: typeof nativeScreenRecordingCommands.macosListDisplays;
|
|
280
264
|
macosScreenshots: typeof screenshotCommands.macosScreenshots;
|
|
281
265
|
macosSource: typeof sourceCommands.macosSource;
|
|
266
|
+
_videoChunksBroadcaster: nativeScreenRecordingCommands.NativeVideoChunksBroadcaster;
|
|
267
|
+
_screenRecorder: recordScreenCommands.ScreenRecorder | null;
|
|
268
|
+
proxyReqRes: (...args: any) => any;
|
|
269
|
+
private isProxyActive;
|
|
270
|
+
private _wda;
|
|
271
|
+
constructor(opts?: InitialOpts);
|
|
272
|
+
get wda(): WDAMacServer;
|
|
273
|
+
onSettingsUpdate(key: string, value: unknown): Promise<void>;
|
|
274
|
+
proxyActive(sessionId: string): boolean;
|
|
275
|
+
getProxyAvoidList(sessionId: string): RouteMatcher[];
|
|
276
|
+
canProxy(): boolean;
|
|
277
|
+
proxyCommand(url: string, method: HTTPMethod, body?: HTTPBody): Promise<any>;
|
|
278
|
+
getStatus(): Promise<any>;
|
|
279
|
+
getWindowRect(): Promise<any>;
|
|
280
|
+
createSession(w3cCaps1: W3CMac2DriverCaps, w3cCaps2?: W3CMac2DriverCaps, w3cCaps3?: W3CMac2DriverCaps, driverData?: DriverData[]): Promise<DefaultCreateSessionResult<Mac2Constraints>>;
|
|
281
|
+
deleteSession(): Promise<void>;
|
|
282
|
+
private resetState;
|
|
282
283
|
}
|
|
283
284
|
export default Mac2Driver;
|
|
284
|
-
type W3CMac2DriverCaps = W3CDriverCaps<Mac2Constraints>;
|
|
285
285
|
//# sourceMappingURL=driver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../../lib/driver.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../../lib/driver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,0BAA0B,EAC1B,UAAU,EACV,WAAW,EACX,YAAY,EACZ,cAAc,E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AC,SAAS,EAAE,MAAM,GAAG,OAAO;IAKvC,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,YAAY,EAAE;IAIpD,QAAQ,IAAI,OAAO;IAItB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,GAAE,QAAe,GAAG,OAAO,CAAC,GAAG,CAAC;IAOzE,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC;IAQlC,aAAa,IAAI,OAAO,CAAC,GAAG,CAAC;IAOpB,aAAa,CAC1B,QAAQ,EAAE,iBAAiB,EAC3B,QAAQ,CAAC,EAAE,iBAAiB,EAC5B,QAAQ,CAAC,EAAE,iBAAiB,EAC5B,UAAU,CAAC,EAAE,UAAU,EAAE,GACxB,OAAO,CAAC,0BAA0B,CAAC,eAAe,CAAC,CAAC;IAgCxC,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IA2C7C,OAAO,CAAC,UAAU;CASnB;AAED,eAAe,UAAU,CAAC"}
|
package/build/lib/driver.js
CHANGED
|
@@ -37,7 +37,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.Mac2Driver = void 0;
|
|
40
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
41
40
|
const driver_1 = require("appium/driver");
|
|
42
41
|
const wda_mac_1 = require("./wda-mac");
|
|
43
42
|
const constraints_1 = __importDefault(require("./constraints"));
|
|
@@ -67,16 +66,52 @@ const NO_PROXY = [
|
|
|
67
66
|
['POST', new RegExp('^/session/[^/]+/timeouts$')],
|
|
68
67
|
];
|
|
69
68
|
class Mac2Driver extends driver_1.BaseDriver {
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
static newMethodMap = method_map_1.newMethodMap;
|
|
70
|
+
static executeMethodMap = execute_method_map_1.executeMethodMap;
|
|
71
|
+
macosLaunchApp = appManagemenetCommands.macosLaunchApp;
|
|
72
|
+
macosActivateApp = appManagemenetCommands.macosActivateApp;
|
|
73
|
+
macosTerminateApp = appManagemenetCommands.macosTerminateApp;
|
|
74
|
+
macosQueryAppState = appManagemenetCommands.macosQueryAppState;
|
|
75
|
+
macosExecAppleScript = appleScriptCommands.macosExecAppleScript;
|
|
76
|
+
execute = executeCommands.execute;
|
|
77
|
+
findElOrEls = findCommands.findElOrEls;
|
|
78
|
+
macosSetValue = gesturesCommands.macosSetValue;
|
|
79
|
+
macosClick = gesturesCommands.macosClick;
|
|
80
|
+
macosScroll = gesturesCommands.macosScroll;
|
|
81
|
+
macosSwipe = gesturesCommands.macosSwipe;
|
|
82
|
+
macosRightClick = gesturesCommands.macosRightClick;
|
|
83
|
+
macosHover = gesturesCommands.macosHover;
|
|
84
|
+
macosDoubleClick = gesturesCommands.macosDoubleClick;
|
|
85
|
+
macosClickAndDrag = gesturesCommands.macosClickAndDrag;
|
|
86
|
+
macosClickAndDragAndHold = gesturesCommands.macosClickAndDragAndHold;
|
|
87
|
+
macosKeys = gesturesCommands.macosKeys;
|
|
88
|
+
macosPressAndHold = gesturesCommands.macosPressAndHold;
|
|
89
|
+
macosTap = gesturesCommands.macosTap;
|
|
90
|
+
macosDoubleTap = gesturesCommands.macosDoubleTap;
|
|
91
|
+
macosPressAndDrag = gesturesCommands.macosPressAndDrag;
|
|
92
|
+
macosPressAndDragAndHold = gesturesCommands.macosPressAndDragAndHold;
|
|
93
|
+
macosGetClipboard = clipboardCommands.macosGetClipboard;
|
|
94
|
+
macosSetClipboard = clipboardCommands.macosSetClipboard;
|
|
95
|
+
macosPerformAccessibilityAudit = auditCommands.macosPerformAccessibilityAudit;
|
|
96
|
+
macosDeepLink = navigationCommands.macosDeepLink;
|
|
97
|
+
startRecordingScreen = recordScreenCommands.startRecordingScreen;
|
|
98
|
+
stopRecordingScreen = recordScreenCommands.stopRecordingScreen;
|
|
99
|
+
macosStartRecordingScreen = recordScreenCommands.macosStartRecordingScreen;
|
|
100
|
+
macosStopRecordingScreen = recordScreenCommands.macosStopRecordingScreen;
|
|
101
|
+
macosStartNativeScreenRecording = nativeScreenRecordingCommands.macosStartNativeScreenRecording;
|
|
102
|
+
macosGetNativeScreenRecordingInfo = nativeScreenRecordingCommands.macosGetNativeScreenRecordingInfo;
|
|
103
|
+
macosStopNativeScreenRecording = nativeScreenRecordingCommands.macosStopNativeScreenRecording;
|
|
104
|
+
macosListDisplays = nativeScreenRecordingCommands.macosListDisplays;
|
|
105
|
+
macosScreenshots = screenshotCommands.macosScreenshots;
|
|
106
|
+
macosSource = sourceCommands.macosSource;
|
|
72
107
|
_videoChunksBroadcaster;
|
|
73
108
|
_screenRecorder;
|
|
74
109
|
proxyReqRes;
|
|
75
|
-
|
|
76
|
-
|
|
110
|
+
isProxyActive;
|
|
111
|
+
_wda;
|
|
77
112
|
constructor(opts = {}) {
|
|
78
113
|
super(opts);
|
|
79
|
-
this.desiredCapConstraints =
|
|
114
|
+
this.desiredCapConstraints = structuredClone(constraints_1.default);
|
|
80
115
|
this.locatorStrategies = [
|
|
81
116
|
'id',
|
|
82
117
|
'name',
|
|
@@ -91,6 +126,12 @@ class Mac2Driver extends driver_1.BaseDriver {
|
|
|
91
126
|
this.resetState();
|
|
92
127
|
this.settings = new driver_1.DeviceSettings({}, this.onSettingsUpdate.bind(this));
|
|
93
128
|
}
|
|
129
|
+
get wda() {
|
|
130
|
+
if (!this._wda) {
|
|
131
|
+
throw new Error('WDA server is not initialized');
|
|
132
|
+
}
|
|
133
|
+
return this._wda;
|
|
134
|
+
}
|
|
94
135
|
async onSettingsUpdate(key, value) {
|
|
95
136
|
if (!this._wda) {
|
|
96
137
|
return;
|
|
@@ -99,12 +140,6 @@ class Mac2Driver extends driver_1.BaseDriver {
|
|
|
99
140
|
settings: { [key]: value },
|
|
100
141
|
});
|
|
101
142
|
}
|
|
102
|
-
get wda() {
|
|
103
|
-
if (!this._wda) {
|
|
104
|
-
throw new Error('WDA server is not initialized');
|
|
105
|
-
}
|
|
106
|
-
return this._wda;
|
|
107
|
-
}
|
|
108
143
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
109
144
|
proxyActive(sessionId) {
|
|
110
145
|
return this.isProxyActive;
|
|
@@ -143,13 +178,13 @@ class Mac2Driver extends driver_1.BaseDriver {
|
|
|
143
178
|
try {
|
|
144
179
|
const prerun = caps.prerun;
|
|
145
180
|
if (prerun) {
|
|
146
|
-
if (
|
|
181
|
+
if (typeof prerun.command !== 'string' && typeof prerun.script !== 'string') {
|
|
147
182
|
throw new Error(`'prerun' capability value must either contain ` +
|
|
148
183
|
`'script' or 'command' entry of string type`);
|
|
149
184
|
}
|
|
150
185
|
logger_1.default.info('Executing prerun AppleScript');
|
|
151
186
|
const output = await this.macosExecAppleScript(prerun.script, undefined, prerun.command);
|
|
152
|
-
if (
|
|
187
|
+
if (output.trim()) {
|
|
153
188
|
logger_1.default.info(`Prerun script output: ${output}`);
|
|
154
189
|
}
|
|
155
190
|
}
|
|
@@ -181,7 +216,7 @@ class Mac2Driver extends driver_1.BaseDriver {
|
|
|
181
216
|
}
|
|
182
217
|
const postrun = this.opts.postrun;
|
|
183
218
|
if (postrun) {
|
|
184
|
-
if (
|
|
219
|
+
if (typeof postrun.command !== 'string' && typeof postrun.script !== 'string') {
|
|
185
220
|
logger_1.default.error(`'postrun' capability value must either contain ` +
|
|
186
221
|
`'script' or 'command' entry of string type`);
|
|
187
222
|
}
|
|
@@ -189,7 +224,7 @@ class Mac2Driver extends driver_1.BaseDriver {
|
|
|
189
224
|
logger_1.default.info('Executing postrun AppleScript');
|
|
190
225
|
try {
|
|
191
226
|
const output = await this.macosExecAppleScript(postrun.script, undefined, postrun.command);
|
|
192
|
-
if (
|
|
227
|
+
if (output.trim()) {
|
|
193
228
|
logger_1.default.info(`Postrun script output: ${output}`);
|
|
194
229
|
}
|
|
195
230
|
}
|
|
@@ -207,42 +242,6 @@ class Mac2Driver extends driver_1.BaseDriver {
|
|
|
207
242
|
this._videoChunksBroadcaster = new nativeScreenRecordingCommands.NativeVideoChunksBroadcaster(this.eventEmitter, this.log);
|
|
208
243
|
this._screenRecorder = null;
|
|
209
244
|
}
|
|
210
|
-
macosLaunchApp = appManagemenetCommands.macosLaunchApp;
|
|
211
|
-
macosActivateApp = appManagemenetCommands.macosActivateApp;
|
|
212
|
-
macosTerminateApp = appManagemenetCommands.macosTerminateApp;
|
|
213
|
-
macosQueryAppState = appManagemenetCommands.macosQueryAppState;
|
|
214
|
-
macosExecAppleScript = appleScriptCommands.macosExecAppleScript;
|
|
215
|
-
execute = executeCommands.execute;
|
|
216
|
-
findElOrEls = findCommands.findElOrEls;
|
|
217
|
-
macosSetValue = gesturesCommands.macosSetValue;
|
|
218
|
-
macosClick = gesturesCommands.macosClick;
|
|
219
|
-
macosScroll = gesturesCommands.macosScroll;
|
|
220
|
-
macosSwipe = gesturesCommands.macosSwipe;
|
|
221
|
-
macosRightClick = gesturesCommands.macosRightClick;
|
|
222
|
-
macosHover = gesturesCommands.macosHover;
|
|
223
|
-
macosDoubleClick = gesturesCommands.macosDoubleClick;
|
|
224
|
-
macosClickAndDrag = gesturesCommands.macosClickAndDrag;
|
|
225
|
-
macosClickAndDragAndHold = gesturesCommands.macosClickAndDragAndHold;
|
|
226
|
-
macosKeys = gesturesCommands.macosKeys;
|
|
227
|
-
macosPressAndHold = gesturesCommands.macosPressAndHold;
|
|
228
|
-
macosTap = gesturesCommands.macosTap;
|
|
229
|
-
macosDoubleTap = gesturesCommands.macosDoubleTap;
|
|
230
|
-
macosPressAndDrag = gesturesCommands.macosPressAndDrag;
|
|
231
|
-
macosPressAndDragAndHold = gesturesCommands.macosPressAndDragAndHold;
|
|
232
|
-
macosGetClipboard = clipboardCommands.macosGetClipboard;
|
|
233
|
-
macosSetClipboard = clipboardCommands.macosSetClipboard;
|
|
234
|
-
macosPerformAccessibilityAudit = auditCommands.macosPerformAccessibilityAudit;
|
|
235
|
-
macosDeepLink = navigationCommands.macosDeepLink;
|
|
236
|
-
startRecordingScreen = recordScreenCommands.startRecordingScreen;
|
|
237
|
-
stopRecordingScreen = recordScreenCommands.stopRecordingScreen;
|
|
238
|
-
macosStartRecordingScreen = recordScreenCommands.macosStartRecordingScreen;
|
|
239
|
-
macosStopRecordingScreen = recordScreenCommands.macosStopRecordingScreen;
|
|
240
|
-
macosStartNativeScreenRecording = nativeScreenRecordingCommands.macosStartNativeScreenRecording;
|
|
241
|
-
macosGetNativeScreenRecordingInfo = nativeScreenRecordingCommands.macosGetNativeScreenRecordingInfo;
|
|
242
|
-
macosStopNativeScreenRecording = nativeScreenRecordingCommands.macosStopNativeScreenRecording;
|
|
243
|
-
macosListDisplays = nativeScreenRecordingCommands.macosListDisplays;
|
|
244
|
-
macosScreenshots = screenshotCommands.macosScreenshots;
|
|
245
|
-
macosSource = sourceCommands.macosSource;
|
|
246
245
|
}
|
|
247
246
|
exports.Mac2Driver = Mac2Driver;
|
|
248
247
|
exports.default = Mac2Driver;
|
package/build/lib/driver.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"driver.js","sourceRoot":"","sources":["../../lib/driver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"driver.js","sourceRoot":"","sources":["../../lib/driver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,0CAAyD;AACzD,uCAA4D;AAC5D,gEAAqE;AACrE,kFAAoE;AACpE,4EAA8D;AAC9D,oEAAsD;AACtD,gEAAkD;AAClD,8DAAgD;AAChD,sEAAwD;AACxD,0EAA4D;AAC5D,+EAAiE;AACjE,2EAA6D;AAC7D,kEAAoD;AACpD,wEAA0D;AAC1D,+FAAiF;AACjF,sDAA2B;AAC3B,6CAA0C;AAC1C,6DAAsD;AAEtD,MAAM,QAAQ,GAAmB;IAC/B,CAAC,KAAK,EAAE,IAAI,MAAM,CAAC,wBAAwB,CAAC,CAAC;IAC7C,CA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AAC;QACF,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;IAC9B,CAAC;;AAhOH,gCAiOC;AAED,kBAAe,UAAU,CAAC"}
|
package/build/lib/utils.d.ts
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Calculates the path to the current module's root folder
|
|
4
|
-
*
|
|
5
|
-
* @returns The full path to module root
|
|
6
|
-
* @throws If the current module root folder cannot be determined
|
|
7
|
-
*/
|
|
8
|
-
export declare const getModuleRoot: (() => string) & _.MemoizedFunction;
|
|
1
|
+
export declare const getModuleRoot: () => string;
|
|
9
2
|
/**
|
|
10
3
|
* Retrieves process ids of all the children processes created by the given
|
|
11
4
|
* parent process identifier
|
|
@@ -15,4 +8,22 @@ export declare const getModuleRoot: (() => string) & _.MemoizedFunction;
|
|
|
15
8
|
* or an empty list if none matched
|
|
16
9
|
*/
|
|
17
10
|
export declare function listChildrenProcessIds(parentPid: number | string): Promise<string[]>;
|
|
11
|
+
/**
|
|
12
|
+
* Clears the content of the given array.
|
|
13
|
+
* @param items The array to clear.
|
|
14
|
+
*/
|
|
15
|
+
export declare function clearArray<T>(items: T[]): void;
|
|
16
|
+
/**
|
|
17
|
+
* Removes all occurrences of the given value from the array.
|
|
18
|
+
* @param items The array to remove the value from.
|
|
19
|
+
* @param value The value to remove.
|
|
20
|
+
*/
|
|
21
|
+
export declare function removeAllOccurrences<T>(items: T[], value: T): void;
|
|
22
|
+
/**
|
|
23
|
+
* Determines whether the given value is a plain object
|
|
24
|
+
* (i.e., an object created by the Object constructor or with a null prototype).
|
|
25
|
+
* @param value The value to check.
|
|
26
|
+
* @returns True if the value is a plain object, false otherwise.
|
|
27
|
+
*/
|
|
28
|
+
export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
|
|
18
29
|
//# sourceMappingURL=utils.d.ts.map
|
package/build/lib/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../lib/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../lib/utils.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,aAAa,QAA6B,MAUtD,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAsB,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAa1F;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,IAAI,CAE9C;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAMlE;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAM9E"}
|
package/build/lib/utils.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.getModuleRoot = void 0;
|
|
7
4
|
exports.listChildrenProcessIds = listChildrenProcessIds;
|
|
8
|
-
|
|
5
|
+
exports.clearArray = clearArray;
|
|
6
|
+
exports.removeAllOccurrences = removeAllOccurrences;
|
|
7
|
+
exports.isPlainObject = isPlainObject;
|
|
9
8
|
const teen_process_1 = require("teen_process");
|
|
10
9
|
const support_1 = require("appium/support");
|
|
11
10
|
const MODULE_NAME = 'appium-mac2-driver';
|
|
@@ -15,13 +14,19 @@ const MODULE_NAME = 'appium-mac2-driver';
|
|
|
15
14
|
* @returns The full path to module root
|
|
16
15
|
* @throws If the current module root folder cannot be determined
|
|
17
16
|
*/
|
|
18
|
-
|
|
17
|
+
let moduleRootCache = null;
|
|
18
|
+
const getModuleRoot = function getModuleRoot() {
|
|
19
|
+
if (moduleRootCache) {
|
|
20
|
+
return moduleRootCache;
|
|
21
|
+
}
|
|
19
22
|
const root = support_1.node.getModuleRootSync(MODULE_NAME, __filename);
|
|
20
23
|
if (!root) {
|
|
21
24
|
throw new Error(`Cannot find the root folder of the ${MODULE_NAME} Node.js module`);
|
|
22
25
|
}
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
moduleRootCache = root;
|
|
27
|
+
return moduleRootCache;
|
|
28
|
+
};
|
|
29
|
+
exports.getModuleRoot = getModuleRoot;
|
|
25
30
|
/**
|
|
26
31
|
* Retrieves process ids of all the children processes created by the given
|
|
27
32
|
* parent process identifier
|
|
@@ -35,12 +40,45 @@ async function listChildrenProcessIds(parentPid) {
|
|
|
35
40
|
// USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND PPID
|
|
36
41
|
return stdout
|
|
37
42
|
.split('\n')
|
|
38
|
-
.
|
|
43
|
+
.map((line) => line.trim())
|
|
44
|
+
.filter(Boolean)
|
|
39
45
|
.map((line) => {
|
|
40
|
-
const [, pid, ...rest] = line.split(/\s+/).filter(
|
|
41
|
-
return [pid,
|
|
46
|
+
const [, pid, ...rest] = line.split(/\s+/).filter(Boolean);
|
|
47
|
+
return [pid, rest.at(-1)];
|
|
42
48
|
})
|
|
43
49
|
.filter(([, ppid]) => ppid === `${parentPid}`)
|
|
44
50
|
.map(([pid]) => String(pid));
|
|
45
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Clears the content of the given array.
|
|
54
|
+
* @param items The array to clear.
|
|
55
|
+
*/
|
|
56
|
+
function clearArray(items) {
|
|
57
|
+
items.length = 0;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Removes all occurrences of the given value from the array.
|
|
61
|
+
* @param items The array to remove the value from.
|
|
62
|
+
* @param value The value to remove.
|
|
63
|
+
*/
|
|
64
|
+
function removeAllOccurrences(items, value) {
|
|
65
|
+
let index = items.indexOf(value);
|
|
66
|
+
while (index >= 0) {
|
|
67
|
+
items.splice(index, 1);
|
|
68
|
+
index = items.indexOf(value);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Determines whether the given value is a plain object
|
|
73
|
+
* (i.e., an object created by the Object constructor or with a null prototype).
|
|
74
|
+
* @param value The value to check.
|
|
75
|
+
* @returns True if the value is a plain object, false otherwise.
|
|
76
|
+
*/
|
|
77
|
+
function isPlainObject(value) {
|
|
78
|
+
if (value === null || typeof value !== 'object') {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
const proto = Object.getPrototypeOf(value);
|
|
82
|
+
return proto === Object.prototype || proto === null;
|
|
83
|
+
}
|
|
46
84
|
//# sourceMappingURL=utils.js.map
|
package/build/lib/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../lib/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../lib/utils.ts"],"names":[],"mappings":";;;AAiCA,wDAaC;AAMD,gCAEC;AAOD,oDAMC;AAQD,sCAMC;AAjFD,+CAAkC;AAClC,4CAAoC;AAEpC,MAAM,WAAW,GAAG,oBAAoB,CAAC;AAEzC;;;;;GAKG;AACH,IAAI,eAAe,GAAkB,IAAI,CAAC;AAEnC,MAAM,aAAa,GAAG,SAAS,aAAa;IACjD,IAAI,eAAe,EAAE,CAAC;QACpB,OAAO,eAAe,CAAC;IACzB,CAAC;IACD,MAAM,IAAI,GAAG,cAAI,CAAC,iBAAiB,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;IAC7D,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CAAC,sCAAsC,WAAW,iBAAiB,CAAC,CAAC;IACtF,CAAC;IACD,eAAe,GA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AAE,CAAC,CAAC,CAAC;QACvB,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,SAAgB,aAAa,CAAC,KAAc;IAC1C,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAChD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAC3C,OAAO,KAAK,KAAK,MAAM,CAAC,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC;AACtD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wda-mac.d.ts","sourceRoot":"","sources":["../../lib/wda-mac.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"wda-mac.d.ts","sourceRoot":"","sources":["../../lib/wda-mac.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,OAAO,EAAS,MAAM,eAAe,CAAC;AAO9C,OAAO,KAAK,EAAC,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAe,MAAM,eAAe,CAAC;AAmBrF,MAAM,WAAW,cAAc;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAiQD,qBAAa,WAAY,SAAQ,OAAO;IAC/B,cAAc,EAAE,OAAO,CAAS;IAExB,YAAY,CACzB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,UAAU,EAClB,IAAI,GAAE,QAAe,GACpB,OAAO,CAAC,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;CAStC;AAED,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAA4B;IAC1C,OAAO,CAAC,QAAQ,CAA8B;IAC9C,OAAO,CAAC,uBAAuB,CAA8B;IAC7D,OAAO,CAAC,yBAAyB,CAAkB;IAEnD,IAAI,KAAK,IAAI,WAAW,CAKvB;IAEK,YAAY,CAAC,IAAI,EAAE,wBAAwB,EAAE,IAAI,GAAE,cAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IA2FtF,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;YAepB,YAAY;IAgB1B;;;;;;OAMG;IACH,OAAO,CAAC,oBAAoB;CAgC7B;AAED,eAAO,MAAM,cAAc,cAAqB,CAAC;AAwCjD,UAAU,wBAAwB;IAChC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB"}
|
package/build/lib/wda-mac.js
CHANGED
|
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.WDA_MAC_SERVER = exports.WDAMacServer = exports.WDAMacProxy = void 0;
|
|
7
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
8
7
|
const node_path_1 = __importDefault(require("node:path"));
|
|
9
8
|
const node_url_1 = __importDefault(require("node:url"));
|
|
10
9
|
const axios_1 = __importDefault(require("axios"));
|
|
@@ -31,17 +30,6 @@ const DEFAULT_SHOW_SERVER_LOGS = false;
|
|
|
31
30
|
const RUNNING_PROCESS_IDS = [];
|
|
32
31
|
const RECENT_UPGRADE_TIMESTAMP_PATH = node_path_1.default.join('.appium', 'webdriveragent_mac', 'upgrade.time');
|
|
33
32
|
const RECENT_MODULE_VERSION_ITEM_NAME = 'recentWdaModuleVersion';
|
|
34
|
-
class WDAMacProxy extends driver_1.JWProxy {
|
|
35
|
-
didProcessExit = false;
|
|
36
|
-
async proxyCommand(url, method, body = null) {
|
|
37
|
-
if (this.didProcessExit) {
|
|
38
|
-
throw new driver_1.errors.InvalidContextError(`'${method} ${url}' cannot be proxied to Mac2 Driver server because ` +
|
|
39
|
-
'its process is not running (probably crashed). Check the Appium log for more details');
|
|
40
|
-
}
|
|
41
|
-
return await super.proxyCommand(url, method, body);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
exports.WDAMacProxy = WDAMacProxy;
|
|
45
33
|
class WDAMacProcess {
|
|
46
34
|
port = DEFAULT_SYSTEM_PORT;
|
|
47
35
|
host = DEFAULT_SYSTEM_HOST;
|
|
@@ -191,7 +179,7 @@ class WDAMacProcess {
|
|
|
191
179
|
if (!this._showServerLogs) {
|
|
192
180
|
return;
|
|
193
181
|
}
|
|
194
|
-
const line =
|
|
182
|
+
const line = (stdout ?? stderr ?? '').trim();
|
|
195
183
|
if (line) {
|
|
196
184
|
log.debug(`[${XCODEBUILD}] ${line}`);
|
|
197
185
|
}
|
|
@@ -208,7 +196,7 @@ class WDAMacProcess {
|
|
|
208
196
|
return;
|
|
209
197
|
}
|
|
210
198
|
const childrenPids = await this.listChildrenPids();
|
|
211
|
-
if (
|
|
199
|
+
if (childrenPids.length > 0) {
|
|
212
200
|
try {
|
|
213
201
|
await (0, teen_process_1.exec)('kill', childrenPids);
|
|
214
202
|
}
|
|
@@ -221,7 +209,7 @@ class WDAMacProcess {
|
|
|
221
209
|
return;
|
|
222
210
|
}
|
|
223
211
|
const childrenPids = await this.listChildrenPids();
|
|
224
|
-
if (
|
|
212
|
+
if (childrenPids.length > 0) {
|
|
225
213
|
try {
|
|
226
214
|
await (0, teen_process_1.exec)('kill', ['-9', ...childrenPids]);
|
|
227
215
|
}
|
|
@@ -234,8 +222,8 @@ class WDAMacProcess {
|
|
|
234
222
|
}
|
|
235
223
|
hasSameOpts(opts) {
|
|
236
224
|
const { showServerLogs, systemPort, systemHost, bootstrapRoot } = opts;
|
|
237
|
-
if ((
|
|
238
|
-
(
|
|
225
|
+
if ((typeof showServerLogs === 'boolean' && this._showServerLogs !== showServerLogs) ||
|
|
226
|
+
(showServerLogs == null && this._showServerLogs !== DEFAULT_SHOW_SERVER_LOGS)) {
|
|
239
227
|
return false;
|
|
240
228
|
}
|
|
241
229
|
if ((systemPort && this.port !== systemPort) ||
|
|
@@ -253,6 +241,17 @@ class WDAMacProcess {
|
|
|
253
241
|
return true;
|
|
254
242
|
}
|
|
255
243
|
}
|
|
244
|
+
class WDAMacProxy extends driver_1.JWProxy {
|
|
245
|
+
didProcessExit = false;
|
|
246
|
+
async proxyCommand(url, method, body = null) {
|
|
247
|
+
if (this.didProcessExit) {
|
|
248
|
+
throw new driver_1.errors.InvalidContextError(`'${method} ${url}' cannot be proxied to Mac2 Driver server because ` +
|
|
249
|
+
'its process is not running (probably crashed). Check the Appium log for more details');
|
|
250
|
+
}
|
|
251
|
+
return await super.proxyCommand(url, method, body);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
exports.WDAMacProxy = WDAMacProxy;
|
|
256
255
|
class WDAMacServer {
|
|
257
256
|
_proxy = null;
|
|
258
257
|
_process = null;
|
|
@@ -331,7 +330,9 @@ class WDAMacServer {
|
|
|
331
330
|
const childrenPids = await this._process.listChildrenPids();
|
|
332
331
|
if (pid !== null) {
|
|
333
332
|
RUNNING_PROCESS_IDS.push(...childrenPids, pid);
|
|
334
|
-
this._process.proc?.on('exit', () =>
|
|
333
|
+
this._process.proc?.on('exit', () => {
|
|
334
|
+
(0, utils_1.removeAllOccurrences)(RUNNING_PROCESS_IDS, pid);
|
|
335
|
+
});
|
|
335
336
|
}
|
|
336
337
|
log.info(`The host process is ready within ${timer.getDuration().asMilliSeconds.toFixed(0)}ms`);
|
|
337
338
|
}
|
|
@@ -401,13 +402,13 @@ class WDAMacServer {
|
|
|
401
402
|
`in the capabilities is invalid. ${e.message}`);
|
|
402
403
|
}
|
|
403
404
|
const { protocol, hostname, port, pathname } = parsedUrl;
|
|
404
|
-
if (
|
|
405
|
+
if (typeof protocol === 'string') {
|
|
405
406
|
scheme = protocol.split(':')[0];
|
|
406
407
|
}
|
|
407
408
|
return {
|
|
408
409
|
scheme,
|
|
409
410
|
host: hostname ?? DEFAULT_SYSTEM_HOST,
|
|
410
|
-
port:
|
|
411
|
+
port: port.length === 0 ? DEFAULT_SYSTEM_PORT : Number.parseInt(port, 10),
|
|
411
412
|
path: pathname === '/' ? '' : pathname,
|
|
412
413
|
};
|
|
413
414
|
}
|
|
@@ -416,23 +417,23 @@ exports.WDAMacServer = WDAMacServer;
|
|
|
416
417
|
exports.WDA_MAC_SERVER = new WDAMacServer();
|
|
417
418
|
// Private functions
|
|
418
419
|
async function cleanupObsoleteProcesses() {
|
|
419
|
-
if (
|
|
420
|
+
if (RUNNING_PROCESS_IDS.length > 0) {
|
|
420
421
|
log.debug(`Cleaning up ${RUNNING_PROCESS_IDS.length} obsolete ` +
|
|
421
422
|
support_1.util.pluralize('process', RUNNING_PROCESS_IDS.length, false));
|
|
422
423
|
try {
|
|
423
424
|
await (0, teen_process_1.exec)('kill', ['-9', ...RUNNING_PROCESS_IDS.map(String)]);
|
|
424
425
|
}
|
|
425
426
|
catch { }
|
|
426
|
-
|
|
427
|
+
(0, utils_1.clearArray)(RUNNING_PROCESS_IDS);
|
|
427
428
|
}
|
|
428
429
|
}
|
|
429
430
|
process.once('exit', () => {
|
|
430
|
-
if (
|
|
431
|
+
if (RUNNING_PROCESS_IDS.length > 0) {
|
|
431
432
|
try {
|
|
432
433
|
(0, node_child_process_1.execSync)(`kill -9 ${RUNNING_PROCESS_IDS.map(String).join(' ')}`);
|
|
433
434
|
}
|
|
434
435
|
catch { }
|
|
435
|
-
|
|
436
|
+
(0, utils_1.clearArray)(RUNNING_PROCESS_IDS);
|
|
436
437
|
}
|
|
437
438
|
});
|
|
438
439
|
//# sourceMappingURL=wda-mac.js.map
|