appium-mac2-driver 2.1.0 → 2.2.0

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 (34) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +16 -0
  3. package/build/lib/commands/bidi/constants.d.ts +3 -0
  4. package/build/lib/commands/bidi/constants.d.ts.map +1 -0
  5. package/build/lib/commands/bidi/constants.js +7 -0
  6. package/build/lib/commands/bidi/constants.js.map +1 -0
  7. package/build/lib/commands/bidi/models.d.ts +3 -0
  8. package/build/lib/commands/bidi/models.d.ts.map +1 -0
  9. package/build/lib/commands/bidi/models.js +14 -0
  10. package/build/lib/commands/bidi/models.js.map +1 -0
  11. package/build/lib/commands/bidi/types.d.ts +12 -0
  12. package/build/lib/commands/bidi/types.d.ts.map +1 -0
  13. package/build/lib/commands/bidi/types.js +3 -0
  14. package/build/lib/commands/bidi/types.js.map +1 -0
  15. package/build/lib/commands/native-record-screen.d.ts +21 -10
  16. package/build/lib/commands/native-record-screen.d.ts.map +1 -1
  17. package/build/lib/commands/native-record-screen.js +201 -35
  18. package/build/lib/commands/native-record-screen.js.map +1 -1
  19. package/build/lib/driver.d.ts +4 -4
  20. package/build/lib/driver.d.ts.map +1 -1
  21. package/build/lib/driver.js +3 -3
  22. package/build/lib/driver.js.map +1 -1
  23. package/build/lib/execute-method-map.d.ts +1 -1
  24. package/build/lib/execute-method-map.d.ts.map +1 -1
  25. package/build/lib/execute-method-map.js +2 -1
  26. package/build/lib/execute-method-map.js.map +1 -1
  27. package/lib/commands/bidi/constants.ts +3 -0
  28. package/lib/commands/bidi/models.ts +15 -0
  29. package/lib/commands/bidi/types.ts +11 -0
  30. package/lib/commands/native-record-screen.ts +198 -39
  31. package/lib/driver.js +7 -7
  32. package/lib/execute-method-map.ts +2 -1
  33. package/npm-shrinkwrap.json +2 -2
  34. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [2.2.0](https://github.com/appium/appium-mac2-driver/compare/v2.1.1...v2.2.0) (2025-02-11)
2
+
3
+
4
+ ### Features
5
+
6
+ * Publish native video chunks over bidi ([#333](https://github.com/appium/appium-mac2-driver/issues/333)) ([6cf4f6d](https://github.com/appium/appium-mac2-driver/commit/6cf4f6d341798290e8416120de2ac93e1263f051))
7
+
8
+ ## [2.1.1](https://github.com/appium/appium-mac2-driver/compare/v2.1.0...v2.1.1) (2025-02-08)
9
+
10
+
11
+ ### Miscellaneous Chores
12
+
13
+ * Update the documentation for the `macos: stopNativeScreenRecording` API ([#331](https://github.com/appium/appium-mac2-driver/issues/331)) ([612b0a0](https://github.com/appium/appium-mac2-driver/commit/612b0a04814fdebd4ec910ad0691aed460251d47))
14
+
1
15
  ## [2.1.0](https://github.com/appium/appium-mac2-driver/compare/v2.0.0...v2.1.0) (2025-02-07)
2
16
 
3
17
 
package/README.md CHANGED
@@ -617,6 +617,12 @@ then it would be stopped automatically upon the test session termination,
617
617
  and leftover videos would be deleted as well.
618
618
  Xcode must be at version 15+.
619
619
 
620
+ > [!TIP]
621
+ > Invocation of this API also triggers broadcasting of
622
+ > [appium:mac2.nativeVideoRecordingChunkAdded](./docs/bidi.md#appiummac2nativevideorecordingchunkadded)
623
+ > BiDi events. Make sure to subscribe to such events **before** this API is invoked to ensure
624
+ > all video chunks are being properly consumed on the client side.
625
+
620
626
  #### Arguments
621
627
 
622
628
  Name | Type | Required | Description | Example
@@ -657,6 +663,15 @@ successfully consumed.
657
663
  If no screen recording has been started before then this API throws an exception.
658
664
  Xcode must be at version 15+.
659
665
 
666
+ > [!IMPORTANT]
667
+ > In order to retrieve the recorded video from the local file system the Appium Server process itself
668
+ > or its parent process (e.g. Terminal) must have the "Full Disk Access" permission granted
669
+ > in 'System Preferences'→'Privacy & Security' tab.
670
+
671
+ > [!NOTE]
672
+ > Be careful while recording lengthy videos. They could be pretty large, and may easily exceed
673
+ > the free space on the home partition.
674
+
660
675
  #### Arguments
661
676
 
662
677
  Name | Type | Required | Description | Example
@@ -668,6 +683,7 @@ method | string | no | The http multipart upload method name. The 'PUT' one is u
668
683
  headers | map | no | Additional headers mapping for multipart http(s) uploads | `{"header": "value"}`
669
684
  fileFieldName | string | no | The name of the form field, where the file content BLOB should be stored for http(s) uploads. `file` by default | payload
670
685
  formFields | Map or `Array<Pair>` | no | Additional form fields for multipart http(s) uploads | `{"field1": "value1", "field2": "value2"}` or `[["field1", "value1"], ["field2", "value2"]]`
686
+ ignorePayload | boolean | no | Whether to ignore the resulting video payload and return an empty string. Useful if you prefer to fetch video chunks via the [appium:mac2.nativeVideoRecordingChunkAdded](./docs/bidi.md#appiummac2nativevideorecordingchunkadded) BiDi event. false by default. | true
671
687
 
672
688
  #### Returns
673
689
 
@@ -0,0 +1,3 @@
1
+ export declare const BIDI_EVENT_NAME = "bidiEvent";
2
+ export declare const NATIVE_VIDEO_CHUNK_ADDED_EVENT = "appium:mac2.nativeVideoRecordingChunkAdded";
3
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../lib/commands/bidi/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,cAAc,CAAC;AAE3C,eAAO,MAAM,8BAA8B,+CAAoD,CAAC"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NATIVE_VIDEO_CHUNK_ADDED_EVENT = exports.BIDI_EVENT_NAME = void 0;
4
+ exports.BIDI_EVENT_NAME = 'bidiEvent';
5
+ const DOMAIN = 'mac2';
6
+ exports.NATIVE_VIDEO_CHUNK_ADDED_EVENT = `appium:${DOMAIN}.nativeVideoRecordingChunkAdded`;
7
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../lib/commands/bidi/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,WAAW,CAAC;AAC3C,MAAM,MAAM,GAAG,MAAM,CAAC;AACT,QAAA,8BAA8B,GAAG,UAAU,MAAM,iCAAiC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { NativeVideoChunkAddedEvent } from './types';
2
+ export declare function toNativeVideoChunkAddedEvent(uuid: string, payload: Buffer): NativeVideoChunkAddedEvent;
3
+ //# sourceMappingURL=models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../../lib/commands/bidi/models.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAG1D,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GACd,0BAA0B,CAQ5B"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toNativeVideoChunkAddedEvent = toNativeVideoChunkAddedEvent;
4
+ const constants_1 = require("./constants");
5
+ function toNativeVideoChunkAddedEvent(uuid, payload) {
6
+ return {
7
+ method: constants_1.NATIVE_VIDEO_CHUNK_ADDED_EVENT,
8
+ params: {
9
+ uuid,
10
+ payload: payload.toString('base64'),
11
+ },
12
+ };
13
+ }
14
+ //# sourceMappingURL=models.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.js","sourceRoot":"","sources":["../../../../lib/commands/bidi/models.ts"],"names":[],"mappings":";;AAGA,oEAWC;AAbD,2CAA6D;AAE7D,SAAgB,4BAA4B,CAC1C,IAAY,EACZ,OAAe;IAEf,OAAO;QACL,MAAM,EAAE,0CAA8B;QACtC,MAAM,EAAE;YACN,IAAI;YACJ,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;SACpC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,12 @@
1
+ interface BiDiEvent<TParams> {
2
+ method: string;
3
+ params: TParams;
4
+ }
5
+ interface NativeVideoChunkAddedParams {
6
+ uuid: string;
7
+ payload: string;
8
+ }
9
+ export interface NativeVideoChunkAddedEvent extends BiDiEvent<NativeVideoChunkAddedParams> {
10
+ }
11
+ export {};
12
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../lib/commands/bidi/types.ts"],"names":[],"mappings":"AAAA,UAAU,SAAS,CAAC,OAAO;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,UAAU,2BAA2B;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,0BAA2B,SAAQ,SAAS,CAAC,2BAA2B,CAAC;CAAG"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../lib/commands/bidi/types.ts"],"names":[],"mappings":""}
@@ -1,5 +1,20 @@
1
1
  import type { Mac2Driver } from '../driver';
2
- import type { StringRecord } from '@appium/types';
2
+ import type { AppiumLogger, StringRecord } from '@appium/types';
3
+ import type EventEmitter from 'node:events';
4
+ export declare class NativeVideoChunksBroadcaster {
5
+ private _ee;
6
+ private _log;
7
+ private _publishers;
8
+ private _terminated;
9
+ constructor(ee: EventEmitter, log: AppiumLogger);
10
+ get hasPublishers(): boolean;
11
+ schedule(uuid: string): void;
12
+ waitFor(uuid: string): Promise<void>;
13
+ shutdown(timeoutMs: number): Promise<void>;
14
+ private _createPublisher;
15
+ private _wait;
16
+ private _cleanup;
17
+ }
3
18
  /**
4
19
  * Initiates a new native screen recording session via XCTest.
5
20
  * If the screen recording is already running then this call results in noop.
@@ -40,20 +55,16 @@ export declare function macosGetNativeScreenRecordingInfo(this: Mac2Driver): Pro
40
55
  * @param fileFieldName The name of the form field, where the file content BLOB should
41
56
  * be stored for http(s) uploads
42
57
  * @param formFields Additional form fields for multipart http(s) uploads
58
+ * @param ignorePayload Whether to ignore the resulting video payload
59
+ * and return an empty string. Useful if you prefer to fetch
60
+ * video chunks via a BiDi web socket.
43
61
  * @returns Base64-encoded content of the recorded media file if 'remotePath'
44
- * parameter is falsy or an empty string.
62
+ * parameter is falsy or an empty string or ignorePayload is set to `true`.
45
63
  * @throws {Error} If there was an error while getting the name of a media file
46
64
  * or the file content cannot be uploaded to the remote location
47
65
  * or screen recording is not supported on the device under test.
48
66
  */
49
- export declare function macosStopNativeScreenRecording(this: Mac2Driver, remotePath?: string, user?: string, pass?: string, method?: string, headers?: StringRecord | [string, any][], fileFieldName?: string, formFields?: StringRecord | [string, string][]): Promise<string>;
50
- /**
51
- * Deletes previously recorded videos with given ids.
52
- * This call is safe and does not raise any errors.
53
- *
54
- * @param uuids One or more video UUIDs to be deleted
55
- */
56
- export declare function cleanupNativeRecordedVideos(this: Mac2Driver, uuids: string | Set<string>): Promise<void>;
67
+ export declare function macosStopNativeScreenRecording(this: Mac2Driver, remotePath?: string, user?: string, pass?: string, method?: string, headers?: StringRecord | [string, any][], fileFieldName?: string, formFields?: StringRecord | [string, string][], ignorePayload?: boolean): Promise<string>;
57
68
  /**
58
69
  * Fetches information about available displays
59
70
  *
@@ -1 +1 @@
1
- {"version":3,"file":"native-record-screen.d.ts","sourceRoot":"","sources":["../../../lib/commands/native-record-screen.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,+BAA+B,CACnD,IAAI,EAAE,UAAU,EAChB,GAAG,CAAC,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE,MAAM,EACd,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,eAAe,CAAC,CAQ1B;AAED;;;;GAIG;AACH,wBAAsB,iCAAiC,CACrD,IAAI,EAAE,UAAU,GACf,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAEjC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,8BAA8B,CAClD,IAAI,EAAE,UAAU,EAChB,UAAU,CAAC,EAAE,MAAM,EACnB,IAAI,CAAC,EAAE,MAAM,EACb,IAAI,CAAC,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,YAAY,GAAC,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,EACtC,aAAa,CAAC,EAAE,MAAM,EACtB,UAAU,CAAC,EAAE,YAAY,GAAC,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,GAC3C,OAAO,CAAC,MAAM,CAAC,CA+BjB;AAED;;;;;GAKG;AACH,wBAAsB,2BAA2B,CAC/C,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,GAC1B,OAAO,CAAC,IAAI,CAAC,CAoBf;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC,CAE5F;AAcD,UAAU,eAAe;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,WAAW;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,OAAO,CAAC;CACjB"}
1
+ {"version":3,"file":"native-record-screen.d.ts","sourceRoot":"","sources":["../../../lib/commands/native-record-screen.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,eAA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AE,OAAO,GACtB,OAAO,CAAC,MAAM,CAAC,CAkDjB;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC,CAE5F;AAmBD,UAAU,eAAe;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,WAAW;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,OAAO,CAAC;CACjB"}
@@ -1,17 +1,185 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
37
  };
5
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.NativeVideoChunksBroadcaster = void 0;
6
40
  exports.macosStartNativeScreenRecording = macosStartNativeScreenRecording;
7
41
  exports.macosGetNativeScreenRecordingInfo = macosGetNativeScreenRecordingInfo;
8
42
  exports.macosStopNativeScreenRecording = macosStopNativeScreenRecording;
9
- exports.cleanupNativeRecordedVideos = cleanupNativeRecordedVideos;
10
43
  exports.macosListDisplays = macosListDisplays;
11
44
  const lodash_1 = __importDefault(require("lodash"));
45
+ const bluebird_1 = __importStar(require("bluebird"));
12
46
  const node_path_1 = __importDefault(require("node:path"));
13
47
  const support_1 = require("appium/support");
14
48
  const helpers_1 = require("./helpers");
49
+ const asyncbox_1 = require("asyncbox");
50
+ const teen_process_1 = require("teen_process");
51
+ const constants_1 = require("./bidi/constants");
52
+ const models_1 = require("./bidi/models");
53
+ const RECORDING_STARTUP_TIMEOUT_MS = 5000;
54
+ const BUFFER_SIZE = 0xFFFF;
55
+ const MONITORING_INTERVAL_DURATION_MS = 1000;
56
+ const MAX_MONITORING_DURATION_MS = 24 * 60 * 60 * 1000; // 1 day
57
+ class NativeVideoChunksBroadcaster {
58
+ constructor(ee, log) {
59
+ this._ee = ee;
60
+ this._log = log;
61
+ this._publishers = new Map();
62
+ this._terminated = false;
63
+ }
64
+ get hasPublishers() {
65
+ return this._publishers.size > 0;
66
+ }
67
+ schedule(uuid) {
68
+ if (!this._publishers.has(uuid)) {
69
+ this._publishers.set(uuid, this._createPublisher(uuid));
70
+ }
71
+ }
72
+ async waitFor(uuid) {
73
+ const publisher = this._publishers.get(uuid);
74
+ if (publisher) {
75
+ await publisher;
76
+ }
77
+ }
78
+ async shutdown(timeoutMs) {
79
+ try {
80
+ await this._wait(timeoutMs);
81
+ }
82
+ catch (e) {
83
+ this._log.warn(e.message);
84
+ }
85
+ await this._cleanup();
86
+ this._publishers = new Map();
87
+ }
88
+ async _createPublisher(uuid) {
89
+ let fullPath = '';
90
+ let bytesRead = 0n;
91
+ try {
92
+ await (0, asyncbox_1.waitForCondition)(async () => {
93
+ const paths = await listAttachments();
94
+ const result = paths.find((name) => name.endsWith(uuid));
95
+ if (result) {
96
+ fullPath = result;
97
+ return true;
98
+ }
99
+ return false;
100
+ }, {
101
+ waitMs: RECORDING_STARTUP_TIMEOUT_MS,
102
+ intervalMs: 300,
103
+ });
104
+ }
105
+ catch {
106
+ throw new Error(`The video recording identified by ${uuid} did not ` +
107
+ `start within ${RECORDING_STARTUP_TIMEOUT_MS}ms timeout`);
108
+ }
109
+ const startedMs = performance.now();
110
+ while (!this._terminated && performance.now() - startedMs < MAX_MONITORING_DURATION_MS) {
111
+ const isCompleted = !(await isFileUsed(fullPath, 'testman'));
112
+ const { size } = await support_1.fs.stat(fullPath, { bigint: true });
113
+ if (bytesRead < size) {
114
+ const handle = await support_1.fs.open(fullPath, 'r');
115
+ try {
116
+ while (bytesRead < size) {
117
+ const bufferSize = Number(size - bytesRead > BUFFER_SIZE ? BUFFER_SIZE : size - bytesRead);
118
+ const buf = Buffer.alloc(bufferSize);
119
+ await support_1.fs.read(handle, buf, 0, bufferSize, bytesRead);
120
+ this._ee.emit(constants_1.BIDI_EVENT_NAME, (0, models_1.toNativeVideoChunkAddedEvent)(uuid, buf));
121
+ bytesRead += BigInt(bufferSize);
122
+ }
123
+ }
124
+ finally {
125
+ await support_1.fs.close(handle);
126
+ }
127
+ }
128
+ if (isCompleted) {
129
+ this._log.debug(`The native video recording identified by ${uuid} has been detected as completed`);
130
+ return;
131
+ }
132
+ await bluebird_1.default.delay(MONITORING_INTERVAL_DURATION_MS);
133
+ }
134
+ this._log.warn(`Stopped monitoring of the native video recording identified by ${uuid} ` +
135
+ `because of the timeout`);
136
+ }
137
+ async _wait(timeoutMs) {
138
+ if (!this.hasPublishers) {
139
+ return;
140
+ }
141
+ const timer = setTimeout(() => {
142
+ this._terminated = true;
143
+ }, timeoutMs);
144
+ const publishingErrors = [];
145
+ for (const publisher of this._publishers.values()) {
146
+ try {
147
+ await publisher;
148
+ }
149
+ catch (e) {
150
+ publishingErrors.push(e.message);
151
+ }
152
+ }
153
+ clearTimeout(timer);
154
+ if (!lodash_1.default.isEmpty(publishingErrors)) {
155
+ throw new Error(publishingErrors.join('\n'));
156
+ }
157
+ }
158
+ async _cleanup() {
159
+ if (!this.hasPublishers) {
160
+ return;
161
+ }
162
+ const attachments = await listAttachments();
163
+ if (lodash_1.default.isEmpty(attachments)) {
164
+ return;
165
+ }
166
+ const tasks = attachments
167
+ .map((attachmentPath) => [node_path_1.default.basename(attachmentPath), attachmentPath])
168
+ .filter(([name,]) => this._publishers.has(name))
169
+ .map(([, attachmentPath]) => support_1.fs.rimraf(attachmentPath));
170
+ if (lodash_1.default.isEmpty(tasks)) {
171
+ return;
172
+ }
173
+ try {
174
+ await Promise.all(tasks);
175
+ this._log.debug(`Successfully deleted ${support_1.util.pluralize('leftover video recording', tasks.length, true)}`);
176
+ }
177
+ catch (e) {
178
+ this._log.warn(`Could not cleanup some leftover video recordings: ${e.message}`);
179
+ }
180
+ }
181
+ }
182
+ exports.NativeVideoChunksBroadcaster = NativeVideoChunksBroadcaster;
15
183
  /**
16
184
  * Initiates a new native screen recording session via XCTest.
17
185
  * If the screen recording is already running then this call results in noop.
@@ -33,7 +201,7 @@ async function macosStartNativeScreenRecording(fps, codec, displayId) {
33
201
  codec,
34
202
  displayId,
35
203
  });
36
- this._recordedVideoIds.add(result.uuid);
204
+ this._videoChunksBroadcaster.schedule(result.uuid);
37
205
  return result;
38
206
  }
39
207
  /**
@@ -62,21 +230,44 @@ async function macosGetNativeScreenRecordingInfo() {
62
230
  * @param fileFieldName The name of the form field, where the file content BLOB should
63
231
  * be stored for http(s) uploads
64
232
  * @param formFields Additional form fields for multipart http(s) uploads
233
+ * @param ignorePayload Whether to ignore the resulting video payload
234
+ * and return an empty string. Useful if you prefer to fetch
235
+ * video chunks via a BiDi web socket.
65
236
  * @returns Base64-encoded content of the recorded media file if 'remotePath'
66
- * parameter is falsy or an empty string.
237
+ * parameter is falsy or an empty string or ignorePayload is set to `true`.
67
238
  * @throws {Error} If there was an error while getting the name of a media file
68
239
  * or the file content cannot be uploaded to the remote location
69
240
  * or screen recording is not supported on the device under test.
70
241
  */
71
- async function macosStopNativeScreenRecording(remotePath, user, pass, method, headers, fileFieldName, formFields) {
242
+ async function macosStopNativeScreenRecording(remotePath, user, pass, method, headers, fileFieldName, formFields, ignorePayload) {
72
243
  const response = (await this.wda.proxy.command('/wda/video/stop', 'POST', {}));
73
244
  if (!response || !lodash_1.default.isPlainObject(response)) {
74
245
  throw new Error('There is no active screen recording, thus nothing to stop. Did you start it before?');
75
246
  }
76
247
  const { uuid } = response;
248
+ try {
249
+ await bluebird_1.default.resolve(this._videoChunksBroadcaster.waitFor(uuid)).timeout(5000);
250
+ }
251
+ catch (e) {
252
+ if (e instanceof bluebird_1.TimeoutError) {
253
+ this.log.debug(`The BiDi chunks broadcaster for the native screen recording identified ` +
254
+ `by ${uuid} cannot complete within 5000ms timeout`);
255
+ }
256
+ else {
257
+ this.log.debug(e.stack);
258
+ }
259
+ }
260
+ if (ignorePayload) {
261
+ return '';
262
+ }
77
263
  const matchedVideoPath = lodash_1.default.first((await listAttachments()).filter((name) => name.endsWith(uuid)));
78
264
  if (!matchedVideoPath) {
79
- throw new Error(`The screen recording identified by ${uuid} has not been found. Is it accessible?`);
265
+ throw new Error(`The screen recording identified by ${uuid} cannot be retrieved. ` +
266
+ `Make sure the Appium Server process or its parent process (e.g. Terminal) ` +
267
+ `has Full Disk Access permission enabled in 'System Preferences' -> 'Privacy & Security' tab. ` +
268
+ `You may verify the presence of the recorded video manually by running the ` +
269
+ `'find "$HOME/Library/Daemon Containers/" -type f -name "${uuid}"' command from Terminal ` +
270
+ `if the latter has been granted the above access permission.`);
80
271
  }
81
272
  const options = {
82
273
  user,
@@ -86,36 +277,7 @@ async function macosStopNativeScreenRecording(remotePath, user, pass, method, he
86
277
  fileFieldName,
87
278
  formFields
88
279
  };
89
- const result = await helpers_1.uploadRecordedMedia.bind(this)(matchedVideoPath, remotePath, options);
90
- await cleanupNativeRecordedVideos.bind(this)(uuid);
91
- this._recordedVideoIds.delete(uuid);
92
- return result;
93
- }
94
- /**
95
- * Deletes previously recorded videos with given ids.
96
- * This call is safe and does not raise any errors.
97
- *
98
- * @param uuids One or more video UUIDs to be deleted
99
- */
100
- async function cleanupNativeRecordedVideos(uuids) {
101
- const attachments = await listAttachments();
102
- if (lodash_1.default.isEmpty(attachments)) {
103
- return;
104
- }
105
- const tasks = attachments
106
- .map((attachmentPath) => [node_path_1.default.basename(attachmentPath), attachmentPath])
107
- .filter(([name,]) => lodash_1.default.isString(uuids) ? uuids === name : uuids.has(name))
108
- .map(([, attachmentPath]) => support_1.fs.rimraf(attachmentPath));
109
- if (lodash_1.default.isEmpty(tasks)) {
110
- return;
111
- }
112
- try {
113
- await Promise.all(tasks);
114
- this.log.debug(`Successfully deleted ${support_1.util.pluralize('leftover video recording', tasks.length, true)}`);
115
- }
116
- catch (e) {
117
- this.log.warn(`Could not cleanup some leftover video recordings: ${e.message}`);
118
- }
280
+ return await helpers_1.uploadRecordedMedia.bind(this)(matchedVideoPath, remotePath, options);
119
281
  }
120
282
  /**
121
283
  * Fetches information about available displays
@@ -135,5 +297,9 @@ async function listAttachments() {
135
297
  absolute: true,
136
298
  });
137
299
  }
300
+ async function isFileUsed(fpath, userProcessName) {
301
+ const { stdout } = await (0, teen_process_1.exec)('lsof', [fpath]);
302
+ return stdout.includes(userProcessName);
303
+ }
138
304
  // #endregion
139
305
  //# sourceMappingURL=native-record-screen.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"native-record-screen.js","sourceRoot":"","sources":["../../../lib/commands/native-record-screen.ts"],"names":[],"mappings":";;;;;AAsBA,0EAaC;AAOD,8EAIC;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AAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO;IACT,CAAC;IACD,IAAI,CAAC;QACH,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACzB,IAAI,CAAC,GAAG,CAAC,KAAK,CACZ,wBAAwB,cAAI,CAAC,SAAS,CAAC,0BAA0B,EAAE,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CACzF,CAAC;IACJ,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,qDAAqD,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IAClF,CAAC;AACH,CAAC;AAED;;;;GAIG;AACI,KAAK,UAAU,iBAAiB;IACrC,OAAO,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,oBAAoB,EAAE,KAAK,CAA8B,CAAC;AAChG,CAAC;AAED,4BAA4B;AAE5B,KAAK,UAAU,eAAe;IAC5B,+BAA+B;IAC/B,6HAA6H;IAC7H,MAAM,oBAAoB,GAAG,mBAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,IAAc,EAAE,SAAS,EAAE,mBAAmB,CAAC,CAAC;IACtG,OAAO,MAAM,YAAE,CAAC,IAAI,CAAC,sBAAsB,EAAE;QAC3C,GAAG,EAAE,oBAAoB;QACzB,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;AACL,CAAC;AAeD,aAAa"}
1
+ {"version":3,"file":"native-record-screen.js","sourceRoot":"","sources":["../../../lib/commands/native-record-screen.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwLA,0EAaC;AAOD,8EAIC;AA6BD,wEA4DC;AAOD,8CAEC;AAlTD,oDAAuB;AACvB,qDAAyC;AACzC,0DAA6B;AAC7B,4CAA0C;AAE1C,uCAAgD;AAGhD,uCAA4C;AAC5C,+CAAoC;AACpC,gDAAmD;AACnD,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AAC;AACrF,CAAC;AAED;;;;GAIG;AACI,KAAK,UAAU,iBAAiB;IACrC,OAAO,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,oBAAoB,EAAE,KAAK,CAA8B,CAAC;AAChG,CAAC;AAED,4BAA4B;AAE5B,KAAK,UAAU,eAAe;IAC5B,+BAA+B;IAC/B,6HAA6H;IAC7H,MAAM,oBAAoB,GAAG,mBAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,IAAc,EAAE,SAAS,EAAE,mBAAmB,CAAC,CAAC;IACtG,OAAO,MAAM,YAAE,CAAC,IAAI,CAAC,sBAAsB,EAAE;QAC3C,GAAG,EAAE,oBAAoB;QACzB,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;AACL,CAAC;AAED,KAAK,UAAU,UAAU,CAAC,KAAa,EAAE,eAAuB;IAC9D,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,IAAA,mBAAI,EAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAC/C,OAAO,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;AAC1C,CAAC;AAeD,aAAa"}
@@ -184,7 +184,7 @@ export class Mac2Driver extends BaseDriver<any, import("@appium/types").StringRe
184
184
  readonly 'macos: stopNativeScreenRecording': {
185
185
  readonly command: "macosStopNativeScreenRecording";
186
186
  readonly params: {
187
- readonly optional: readonly ["remotePath", "user", "pass", "method", "headers", "fileFieldName", "formFields"];
187
+ readonly optional: readonly ["remotePath", "user", "pass", "method", "headers", "fileFieldName", "formFields", "ignorePayload"];
188
188
  };
189
189
  };
190
190
  readonly 'macos: listDisplays': {
@@ -196,8 +196,8 @@ export class Mac2Driver extends BaseDriver<any, import("@appium/types").StringRe
196
196
  isProxyActive: boolean;
197
197
  /** @type {import('./wda-mac').WDAMacServer} */
198
198
  wda: import("./wda-mac").WDAMacServer;
199
- /** @type {Set<string>} */
200
- _recordedVideoIds: Set<string>;
199
+ /** @type {nativeScreenRecordingCommands.NativeVideoChunksBroadcaster} */
200
+ _videoChunksBroadcaster: nativeScreenRecordingCommands.NativeVideoChunksBroadcaster;
201
201
  desiredCapConstraints: {
202
202
  systemPort: {
203
203
  isNumber: boolean;
@@ -298,6 +298,7 @@ export class Mac2Driver extends BaseDriver<any, import("@appium/types").StringRe
298
298
  }
299
299
  export default Mac2Driver;
300
300
  import { BaseDriver } from 'appium/driver';
301
+ import * as nativeScreenRecordingCommands from './commands/native-record-screen';
301
302
  import { DeviceSettings } from 'appium/driver';
302
303
  import * as appManagemenetCommands from './commands/app-management';
303
304
  import * as appleScriptCommands from './commands/applescript';
@@ -306,7 +307,6 @@ import * as findCommands from './commands/find';
306
307
  import * as gesturesCommands from './commands/gestures';
307
308
  import * as navigationCommands from './commands/navigation';
308
309
  import * as recordScreenCommands from './commands/record-screen';
309
- import * as nativeScreenRecordingCommands from './commands/native-record-screen';
310
310
  import * as screenshotCommands from './commands/screenshots';
311
311
  import * as sourceCommands from './commands/source';
312
312
  //# sourceMappingURL=driver.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../../lib/driver.js"],"names":[],"mappings":"AA8BA;IAUE;;;;;;;;;;;;;;;;;MAAmC;IACnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAA2C;IAE3C,uBAqBC;IAjCD,sBAAsB;IACtB,eADW,OAAO,CACJ;IAEd,+CAA+C;IAC/C,KADW,OAAO,WAAW,EAAE,YAAY,CACvC;IAEJ,0BAA0B;IAC1B,mBADW,GAAG,CAAC,MAAM,CAAC,CACJ;IAQhB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AO,CACJ;IAEd,+CAA+C;IAC/C,KADW,OAAO,WAAW,EAAE,YAAY,CACvC;IAEJ,yEAAyE;IACzE,yBADW,6BAA6B,CAAC,4BAA4B,CAC7C;IAQtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAAkD;IAiBlD,6BAAwE;IAG1E,yDAIC;IAED,mBASC;IANC,iBAAuB;IAKvB,qBAA2B;IAI7B,qCAEC;IAGD,0EAEC;IAED,oBAEC;IAED,mEAEC;IAGD,8BAEC;IAGD,kCAEC;IAGD,6FAwBC;IAED,+BA8BC;IAED,6DAAuD;IACvD,iEAA2D;IAC3D,mEAA6D;IAC7D,qEAA+D;IAE/D,sEAAgE;IAEhE,wCAAkC;IAElC,6CAAuC;IAEvC,qDAA+C;IAC/C,+CAAyC;IACzC,iDAA2C;IAC3C,+CAAyC;IACzC,yDAAmD;IACnD,+CAAyC;IACzC,2DAAqD;IACrD,6DAAuD;IACvD,2EAAqE;IACrE,6CAAuC;IACvC,6DAAuD;IACvD,2CAAqC;IACrC,uDAAiD;IACjD,6DAAuD;IACvD,2EAAqE;IAErE,uDAAiD;IAEjD,uEAAiE;IACjE,qEAA+D;IAE/D,sGAAgG;IAChG,0GAAoG;IACpG,oGAA8F;IAC9F,0EAAoE;IAEpE,6DAAuD;IAEvD,+CAAyC;CAC1C;;2BAjN0C,eAAe;+CAeX,iCAAiC;+BAfrC,eAAe;wCAGlB,2BAA2B;qCAC9B,wBAAwB;iCAC5B,oBAAoB;8BACvB,iBAAiB;kCACb,qBAAqB;oCACnB,uBAAuB;sCACrB,0BAA0B;oCAC5B,wBAAwB;gCAC5B,mBAAmB"}
@@ -125,7 +125,7 @@ class Mac2Driver extends driver_1.BaseDriver {
125
125
  this.wda = null;
126
126
  this.proxyReqRes = null;
127
127
  this.isProxyActive = false;
128
- this._recordedVideoIds = new Set();
128
+ this._videoChunksBroadcaster = new nativeScreenRecordingCommands.NativeVideoChunksBroadcaster(this.eventEmitter, this.log);
129
129
  this._screenRecorder = null;
130
130
  }
131
131
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -179,12 +179,12 @@ class Mac2Driver extends driver_1.BaseDriver {
179
179
  }
180
180
  async deleteSession() {
181
181
  await this._screenRecorder?.stop(true);
182
- if (!lodash_1.default.isEmpty(this._recordedVideoIds)) {
182
+ if (this._videoChunksBroadcaster.hasPublishers) {
183
183
  try {
184
184
  await this.wda.proxy.command('/wda/video/stop', 'POST', {});
185
185
  }
186
186
  catch { }
187
- await nativeScreenRecordingCommands.cleanupNativeRecordedVideos.bind(this)(this._recordedVideoIds);
187
+ await this._videoChunksBroadcaster.shutdown(5000);
188
188
  }
189
189
  await this.wda.stopSession();
190
190
  if (this.opts.postrun) {
@@ -1 +1 @@
1
- {"version":3,"file":"driver.js","sourceRoot":"","sources":["../../lib/driver.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAuB;AACvB,0CAA2D;AAC3D,wDAAuC;AACvC,iDAAuD;AACvD,kFAAoE;AACpE,4EAA8D;AAC9D,oEAAsD;AACtD,8DAAgD;AAChD,sEAAwD;AACxD,0EAA4D;AAC5D,+EAAiE;AACjE,2EAA6D;AAC7D,kEAAoD;AACpD,sDAA2B;AAC3B,6CAA4C;AAC5C,6DAAwD;AACxD,+FAAiF;AAEjF,qDAAqD;AACrD,MAAM,QAAQ,GAAG;IACf,CAAC,KAAK,EAAE,IAAI,MAAM,CAAC,wBAAwB,CAAC,CAAC;IAC7C,CAAC,MAAM,EAAE,IAAI,MAAM,CAAC,wBAAwB,CAAC,CAAC;IAC9C,CAAC,MAAM,EAAE,IAAI,MAAM,CAAC,0CAA0C,CAAC,CAAC;IAChE,CAAC,MAAM,EAAE,IAAI,MAAM,CAAC,4BAA4B,CAAC,CAAC;IAClD,CAAC,MAAM,EAAE,IAAI,MAAM,CAAC,yBAAyB,CAAC,CAAC;IAC/C,CAAC,MAAM,EAAE,IAAI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AAI,CAAC,+BAA+B,CAAC,CAAC;gBAC1C,IAAI,CAAC;oBACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;oBAClE,IAAI,gBAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;wBACnB,gBAAG,CAAC,IAAI,CAAC,0BAA0B,MAAM,EAAE,CAAC,CAAC;oBAC/C,CAAC;gBACH,CAAC;gBAAC,OAAO,CAAC,EAAE,CAAC;oBACX,gBAAG,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;gBACvB,CAAC;YACH,CAAC;QACH,CAAC;QAED,IAAI,CAAC,UAAU,EAAE,CAAC;QAElB,MAAM,KAAK,CAAC,aAAa,EAAE,CAAC;IAC9B,CAAC;;AA1IH,gCAoLC;AA1KQ,uBAAY,GAAG,yBAAY,AAAf,CAAgB;AAC5B,2BAAgB,GAAG,qCAAgB,AAAnB,CAAoB;AA2K7C,kBAAe,UAAU,CAAC"}
@@ -165,7 +165,7 @@ export declare const executeMethodMap: {
165
165
  readonly 'macos: stopNativeScreenRecording': {
166
166
  readonly command: "macosStopNativeScreenRecording";
167
167
  readonly params: {
168
- readonly optional: readonly ["remotePath", "user", "pass", "method", "headers", "fileFieldName", "formFields"];
168
+ readonly optional: readonly ["remotePath", "user", "pass", "method", "headers", "fileFieldName", "formFields", "ignorePayload"];
169
169
  };
170
170
  };
171
171
  readonly 'macos: listDisplays': {
@@ -1 +1 @@
1
- {"version":3,"file":"execute-method-map.d.ts","sourceRoot":"","sources":["../../lib/execute-method-map.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4Ua,CAAC"}
1
+ {"version":3,"file":"execute-method-map.d.ts","sourceRoot":"","sources":["../../lib/execute-method-map.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6Ua,CAAC"}
@@ -326,7 +326,8 @@ exports.executeMethodMap = {
326
326
  'method',
327
327
  'headers',
328
328
  'fileFieldName',
329
- 'formFields'
329
+ 'formFields',
330
+ 'ignorePayload',
330
331
  ],
331
332
  },
332
333
  },
@@ -1 +1 @@
1
- {"version":3,"file":"execute-method-map.js","sourceRoot":"","sources":["../../lib/execute-method-map.ts"],"names":[],"mappings":";;;AAEa,QAAA,gBAAgB,GAAG;IAC9B,cAAc,EAAE;QACd,OAAO,EAAE,YAAY;QACrB,MAAM,EAAE;YACN,QAAQ,EAAE;gBACR,WAAW;gBACX,GAAG;gBACH,GAAG;gBACH,kBAAkB;aACnB;SACF;KACF;IACD,eAAe,EAAE;QACf,OAAO,EAAE,aAAa;QACtB,MAAM,EAAE;YACN,QAAQ,EAAE;gBACR,QAAQ;gBACR,QAAQ;aACT;YACD,QAAQ,EAAE;gBACR,WAAW;gBACX,GAAG;gBACH,GAAG;gBACH,kBAAkB;aACnB;SACF;KACF;IACD,cAAc,EAAE;QACd,OAAO,EAAE,YAAY;QACrB,MAAM,EAAE;YACN,QAAQ,EAAE;gBACR,WAAW;aACZ;YACD,QAAQ,EAAE;gBACR,WAAW;gBACX,GAAG;gBACH,GAAG;gBACH,UAAU;gBACV,kBAAkB;aACnB;SACF;KACF;IACD,mBAAmB,EAAE;QACnB,OAAO,EAAE,iBAAiB;QAC1B,MAAM,EAAE;Y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;gBACR,SAAS;gBACT,eAAe;gBACf,YAAY;aACb;SACF;KACF;IACD,qBAAqB,EAAE;QACrB,OAAO,EAAE,mBAAmB;KAC7B;CACuC,CAAC"}
1
+ {"version":3,"file":"execute-method-map.js","sourceRoot":"","sources":["../../lib/execute-method-map.ts"],"names":[],"mappings":";;;AAEa,QAAA,gBAAgB,GAAG;IAC9B,cAAc,EAAE;QACd,OAAO,EAAE,YAAY;QACrB,MAAM,EAAE;YACN,QAAQ,EAAE;gBACR,WAAW;gBACX,GAAG;gBACH,GAAG;gBACH,kBAAkB;aACnB;SACF;KACF;IACD,eAAe,EAAE;QACf,OAAO,EAAE,aAAa;QACtB,MAAM,EAAE;YACN,QAAQ,EAAE;gBACR,QAAQ;gBACR,QAAQ;aACT;YACD,QAAQ,EAAE;gBACR,WAAW;gBACX,GAAG;gBACH,GAAG;gBACH,kBAAkB;aACnB;SACF;KACF;IACD,cAAc,EAAE;QACd,OAAO,EAAE,YAAY;QACrB,MAAM,EAAE;YACN,QAAQ,EAAE;gBACR,WAAW;aACZ;YACD,QAAQ,EAAE;gBACR,WAAW;gBACX,GAAG;gBACH,GAAG;gBACH,UAAU;gBACV,kBAAkB;aACnB;SACF;KACF;IACD,mBAAmB,EAAE;QACnB,OAAO,EAAE,iBAAiB;QAC1B,MAAM,EAAE;YACN,QAAQ,EAAE;gBACR,WAAW;gBACX,GAAG;gBACH,GAAG;gBACH,kBAAkB;aACnB;SACF;KACF;IACD,cAAc,EAAE;QACd,OAAO,EAAE,YAAY;QACrB,MAAM,EAAE;YACN,QAAQ,EAAE;gBACR,WAAW;gBACX,GAAG;gBACH,GAAG;gBACH,kBAAkB;aACnB;SACF;KACF;IACD,oBAAoB,EAAE;QACpB,OAAO,EAAE,kBAAkB;QAC3B,MAAM,EAAE;YACN,QAAQ,EAAE;gBACR,WAAW;gBACX,GAAG;gBACH,GAAG;gBACH,kBAAkB;aACnB;SACF;KACF;IACD,qBAAqB,EAAE;QACrB,OAAO,EAAE,mBA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AAO,EAAE,oBAAoB;QAC7B,MAAM,EAAE;YACN,QAAQ,EAAE;gBACR,UAAU;gBACV,MAAM;aACP;SACF;KACF;IACD,6BAA6B,EAAE;QAC7B,OAAO,EAAE,sBAAsB;QAC/B,MAAM,EAAE;YACN,QAAQ,EAAE;gBACR,UAAU;aACX;YACD,QAAQ,EAAE;gBACR,WAAW;gBACX,aAAa;gBACb,KAAK;gBACL,QAAQ;gBACR,eAAe;gBACf,eAAe;gBACf,cAAc;aACf;SACF;KACF;IACD,4BAA4B,EAAE;QAC5B,OAAO,EAAE,qBAAqB;QAC9B,MAAM,EAAE;YACN,QAAQ,EAAE;gBACR,YAAY;gBACZ,MAAM;gBACN,MAAM;gBACN,QAAQ;gBACR,SAAS;gBACT,eAAe;gBACf,YAAY;aACb;SACF;KACF;IACD,mCAAmC,EAAE;QACnC,OAAO,EAAE,iCAAiC;QAC1C,MAAM,EAAE;YACN,QAAQ,EAAE;gBACR,KAAK;gBACL,OAAO;gBACP,WAAW;aACZ;SACF;KACF;IACD,qCAAqC,EAAE;QACrC,OAAO,EAAE,mCAAmC;KAC7C;IACD,kCAAkC,EAAE;QAClC,OAAO,EAAE,gCAAgC;QACzC,MAAM,EAAE;YACN,QAAQ,EAAE;gBACR,YAAY;gBACZ,MAAM;gBACN,MAAM;gBACN,QAAQ;gBACR,SAAS;gBACT,eAAe;gBACf,YAAY;gBACZ,eAAe;aAChB;SACF;KACF;IACD,qBAAqB,EAAE;QACrB,OAAO,EAAE,mBAAmB;KAC7B;CACuC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export const BIDI_EVENT_NAME = 'bidiEvent';
2
+ const DOMAIN = 'mac2';
3
+ export const NATIVE_VIDEO_CHUNK_ADDED_EVENT = `appium:${DOMAIN}.nativeVideoRecordingChunkAdded`;
@@ -0,0 +1,15 @@
1
+ import type { NativeVideoChunkAddedEvent } from './types';
2
+ import { NATIVE_VIDEO_CHUNK_ADDED_EVENT } from './constants';
3
+
4
+ export function toNativeVideoChunkAddedEvent(
5
+ uuid: string,
6
+ payload: Buffer,
7
+ ): NativeVideoChunkAddedEvent {
8
+ return {
9
+ method: NATIVE_VIDEO_CHUNK_ADDED_EVENT,
10
+ params: {
11
+ uuid,
12
+ payload: payload.toString('base64'),
13
+ },
14
+ };
15
+ }
@@ -0,0 +1,11 @@
1
+ interface BiDiEvent<TParams> {
2
+ method: string;
3
+ params: TParams;
4
+ }
5
+
6
+ interface NativeVideoChunkAddedParams {
7
+ uuid: string;
8
+ payload: string;
9
+ }
10
+
11
+ export interface NativeVideoChunkAddedEvent extends BiDiEvent<NativeVideoChunkAddedParams> {}
@@ -1,9 +1,171 @@
1
1
  import _ from 'lodash';
2
+ import B, {TimeoutError} from 'bluebird';
2
3
  import path from 'node:path';
3
4
  import { fs, util } from 'appium/support';
4
5
  import type { Mac2Driver } from '../driver';
5
6
  import { uploadRecordedMedia } from './helpers';
6
- import type { StringRecord } from '@appium/types';
7
+ import type { AppiumLogger, StringRecord } from '@appium/types';
8
+ import type EventEmitter from 'node:events';
9
+ import { waitForCondition } from 'asyncbox';
10
+ import { exec } from 'teen_process';
11
+ import { BIDI_EVENT_NAME } from './bidi/constants';
12
+ import { toNativeVideoChunkAddedEvent } from './bidi/models';
13
+
14
+ const RECORDING_STARTUP_TIMEOUT_MS = 5000;
15
+ const BUFFER_SIZE = 0xFFFF;
16
+ const MONITORING_INTERVAL_DURATION_MS = 1000;
17
+ const MAX_MONITORING_DURATION_MS = 24 * 60 * 60 * 1000; // 1 day
18
+
19
+ export class NativeVideoChunksBroadcaster {
20
+ private _ee: EventEmitter;
21
+ private _log: AppiumLogger;
22
+ private _publishers: Map<string, Promise<void>>;
23
+ private _terminated: boolean;
24
+
25
+ constructor (ee: EventEmitter, log: AppiumLogger) {
26
+ this._ee = ee;
27
+ this._log = log;
28
+ this._publishers = new Map();
29
+ this._terminated = false;
30
+ }
31
+
32
+ get hasPublishers(): boolean {
33
+ return this._publishers.size > 0;
34
+ }
35
+
36
+ schedule(uuid: string): void {
37
+ if (!this._publishers.has(uuid)) {
38
+ this._publishers.set(uuid, this._createPublisher(uuid));
39
+ }
40
+ }
41
+
42
+ async waitFor(uuid: string): Promise<void> {
43
+ const publisher = this._publishers.get(uuid);
44
+ if (publisher) {
45
+ await publisher;
46
+ }
47
+ }
48
+
49
+ async shutdown(timeoutMs: number): Promise<void> {
50
+ try {
51
+ await this._wait(timeoutMs);
52
+ } catch (e) {
53
+ this._log.warn(e.message);
54
+ }
55
+
56
+ await this._cleanup();
57
+
58
+ this._publishers = new Map();
59
+ }
60
+
61
+ private async _createPublisher(uuid: string): Promise<void> {
62
+ let fullPath = '';
63
+ let bytesRead = 0n;
64
+ try {
65
+ await waitForCondition(async () => {
66
+ const paths = await listAttachments();
67
+ const result = paths.find((name) => name.endsWith(uuid));
68
+ if (result) {
69
+ fullPath = result;
70
+ return true;
71
+ }
72
+ return false;
73
+ }, {
74
+ waitMs: RECORDING_STARTUP_TIMEOUT_MS,
75
+ intervalMs: 300,
76
+ });
77
+ } catch {
78
+ throw new Error(
79
+ `The video recording identified by ${uuid} did not ` +
80
+ `start within ${RECORDING_STARTUP_TIMEOUT_MS}ms timeout`
81
+ );
82
+ }
83
+
84
+ const startedMs = performance.now();
85
+ while (!this._terminated && performance.now() - startedMs < MAX_MONITORING_DURATION_MS) {
86
+ const isCompleted = !(await isFileUsed(fullPath, 'testman'));
87
+
88
+ const { size } = await fs.stat(fullPath, {bigint: true});
89
+ if (bytesRead < size) {
90
+ const handle = await fs.open(fullPath, 'r');
91
+ try {
92
+ while (bytesRead < size) {
93
+ const bufferSize = Number(size - bytesRead > BUFFER_SIZE ? BUFFER_SIZE : size - bytesRead);
94
+ const buf = Buffer.alloc(bufferSize);
95
+ await fs.read(handle, buf as any, 0, bufferSize, bytesRead as any);
96
+ this._ee.emit(BIDI_EVENT_NAME, toNativeVideoChunkAddedEvent(uuid, buf));
97
+ bytesRead += BigInt(bufferSize);
98
+ }
99
+ } finally {
100
+ await fs.close(handle);
101
+ }
102
+ }
103
+
104
+ if (isCompleted) {
105
+ this._log.debug(
106
+ `The native video recording identified by ${uuid} has been detected as completed`
107
+ );
108
+ return;
109
+ }
110
+
111
+ await B.delay(MONITORING_INTERVAL_DURATION_MS);
112
+ }
113
+
114
+ this._log.warn(
115
+ `Stopped monitoring of the native video recording identified by ${uuid} ` +
116
+ `because of the timeout`
117
+ );
118
+ }
119
+
120
+ private async _wait(timeoutMs: number): Promise<void> {
121
+ if (!this.hasPublishers) {
122
+ return;
123
+ }
124
+
125
+ const timer = setTimeout(() => {
126
+ this._terminated = true;
127
+ }, timeoutMs);
128
+ const publishingErrors: string[] = [];
129
+ for (const publisher of this._publishers.values()) {
130
+ try {
131
+ await publisher;
132
+ } catch (e) {
133
+ publishingErrors.push(e.message);
134
+ }
135
+ }
136
+ clearTimeout(timer);
137
+
138
+ if (!_.isEmpty(publishingErrors)) {
139
+ throw new Error(publishingErrors.join('\n'));
140
+ }
141
+ }
142
+
143
+ private async _cleanup(): Promise<void> {
144
+ if (!this.hasPublishers) {
145
+ return;
146
+ }
147
+
148
+ const attachments = await listAttachments();
149
+ if (_.isEmpty(attachments)) {
150
+ return;
151
+ }
152
+ const tasks: Promise<any>[] = attachments
153
+ .map((attachmentPath) => [path.basename(attachmentPath), attachmentPath])
154
+ .filter(([name,]) => this._publishers.has(name))
155
+ .map(([, attachmentPath]) => fs.rimraf(attachmentPath));
156
+ if (_.isEmpty(tasks)) {
157
+ return;
158
+ }
159
+ try {
160
+ await Promise.all(tasks);
161
+ this._log.debug(
162
+ `Successfully deleted ${util.pluralize('leftover video recording', tasks.length, true)}`
163
+ );
164
+ } catch (e) {
165
+ this._log.warn(`Could not cleanup some leftover video recordings: ${e.message}`);
166
+ }
167
+ }
168
+ }
7
169
 
8
170
  /**
9
171
  * Initiates a new native screen recording session via XCTest.
@@ -31,7 +193,7 @@ export async function macosStartNativeScreenRecording(
31
193
  codec,
32
194
  displayId,
33
195
  }) as ActiveVideoInfo;
34
- this._recordedVideoIds.add(result.uuid);
196
+ this._videoChunksBroadcaster.schedule(result.uuid);
35
197
  return result;
36
198
  }
37
199
 
@@ -64,8 +226,11 @@ export async function macosGetNativeScreenRecordingInfo(
64
226
  * @param fileFieldName The name of the form field, where the file content BLOB should
65
227
  * be stored for http(s) uploads
66
228
  * @param formFields Additional form fields for multipart http(s) uploads
229
+ * @param ignorePayload Whether to ignore the resulting video payload
230
+ * and return an empty string. Useful if you prefer to fetch
231
+ * video chunks via a BiDi web socket.
67
232
  * @returns Base64-encoded content of the recorded media file if 'remotePath'
68
- * parameter is falsy or an empty string.
233
+ * parameter is falsy or an empty string or ignorePayload is set to `true`.
69
234
  * @throws {Error} If there was an error while getting the name of a media file
70
235
  * or the file content cannot be uploaded to the remote location
71
236
  * or screen recording is not supported on the device under test.
@@ -79,6 +244,7 @@ export async function macosStopNativeScreenRecording(
79
244
  headers?: StringRecord|[string, any][],
80
245
  fileFieldName?: string,
81
246
  formFields?: StringRecord|[string, string][],
247
+ ignorePayload?: boolean,
82
248
  ): Promise<string> {
83
249
  const response: ActiveVideoInfo | null = (
84
250
  await this.wda.proxy.command('/wda/video/stop', 'POST', {})
@@ -90,12 +256,34 @@ export async function macosStopNativeScreenRecording(
90
256
  }
91
257
 
92
258
  const { uuid } = response;
259
+ try {
260
+ await B.resolve(this._videoChunksBroadcaster.waitFor(uuid)).timeout(5000);
261
+ } catch (e) {
262
+ if (e instanceof TimeoutError) {
263
+ this.log.debug(
264
+ `The BiDi chunks broadcaster for the native screen recording identified ` +
265
+ `by ${uuid} cannot complete within 5000ms timeout`
266
+ );
267
+ } else {
268
+ this.log.debug(e.stack);
269
+ }
270
+ }
271
+
272
+ if (ignorePayload) {
273
+ return '';
274
+ }
275
+
93
276
  const matchedVideoPath = _.first(
94
277
  (await listAttachments()).filter((name) => name.endsWith(uuid))
95
278
  );
96
279
  if (!matchedVideoPath) {
97
280
  throw new Error(
98
- `The screen recording identified by ${uuid} has not been found. Is it accessible?`
281
+ `The screen recording identified by ${uuid} cannot be retrieved. ` +
282
+ `Make sure the Appium Server process or its parent process (e.g. Terminal) ` +
283
+ `has Full Disk Access permission enabled in 'System Preferences' -> 'Privacy & Security' tab. ` +
284
+ `You may verify the presence of the recorded video manually by running the ` +
285
+ `'find "$HOME/Library/Daemon Containers/" -type f -name "${uuid}"' command from Terminal ` +
286
+ `if the latter has been granted the above access permission.`
99
287
  );
100
288
  }
101
289
  const options = {
@@ -106,41 +294,7 @@ export async function macosStopNativeScreenRecording(
106
294
  fileFieldName,
107
295
  formFields
108
296
  };
109
- const result = await uploadRecordedMedia.bind(this)(matchedVideoPath, remotePath, options);
110
- await cleanupNativeRecordedVideos.bind(this)(uuid);
111
- this._recordedVideoIds.delete(uuid);
112
- return result;
113
- }
114
-
115
- /**
116
- * Deletes previously recorded videos with given ids.
117
- * This call is safe and does not raise any errors.
118
- *
119
- * @param uuids One or more video UUIDs to be deleted
120
- */
121
- export async function cleanupNativeRecordedVideos(
122
- this: Mac2Driver,
123
- uuids: string | Set<string>,
124
- ): Promise<void> {
125
- const attachments = await listAttachments();
126
- if (_.isEmpty(attachments)) {
127
- return;
128
- }
129
- const tasks: Promise<any>[] = attachments
130
- .map((attachmentPath) => [path.basename(attachmentPath), attachmentPath])
131
- .filter(([name,]) => _.isString(uuids) ? uuids === name : uuids.has(name))
132
- .map(([, attachmentPath]) => fs.rimraf(attachmentPath));
133
- if (_.isEmpty(tasks)) {
134
- return;
135
- }
136
- try {
137
- await Promise.all(tasks);
138
- this.log.debug(
139
- `Successfully deleted ${util.pluralize('leftover video recording', tasks.length, true)}`
140
- );
141
- } catch (e) {
142
- this.log.warn(`Could not cleanup some leftover video recordings: ${e.message}`);
143
- }
297
+ return await uploadRecordedMedia.bind(this)(matchedVideoPath, remotePath, options);
144
298
  }
145
299
 
146
300
  /**
@@ -164,6 +318,11 @@ async function listAttachments(): Promise<string[]> {
164
318
  });
165
319
  }
166
320
 
321
+ async function isFileUsed(fpath: string, userProcessName: string): Promise<boolean> {
322
+ const { stdout } = await exec('lsof', [fpath]);
323
+ return stdout.includes(userProcessName);
324
+ }
325
+
167
326
  interface ActiveVideoInfo {
168
327
  fps: number;
169
328
  codec: number;
package/lib/driver.js CHANGED
@@ -35,8 +35,8 @@ export class Mac2Driver extends BaseDriver {
35
35
  /** @type {import('./wda-mac').WDAMacServer} */
36
36
  wda;
37
37
 
38
- /** @type {Set<string>} */
39
- _recordedVideoIds;
38
+ /** @type {nativeScreenRecordingCommands.NativeVideoChunksBroadcaster} */
39
+ _videoChunksBroadcaster;
40
40
 
41
41
  static newMethodMap = newMethodMap;
42
42
  static executeMethodMap = executeMethodMap;
@@ -75,7 +75,9 @@ export class Mac2Driver extends BaseDriver {
75
75
  this.wda = null;
76
76
  this.proxyReqRes = null;
77
77
  this.isProxyActive = false;
78
- this._recordedVideoIds = new Set();
78
+ this._videoChunksBroadcaster = new nativeScreenRecordingCommands.NativeVideoChunksBroadcaster(
79
+ this.eventEmitter, this.log
80
+ );
79
81
  this._screenRecorder = null;
80
82
  }
81
83
 
@@ -136,13 +138,11 @@ export class Mac2Driver extends BaseDriver {
136
138
 
137
139
  async deleteSession () {
138
140
  await this._screenRecorder?.stop(true);
139
- if (!_.isEmpty(this._recordedVideoIds)) {
141
+ if (this._videoChunksBroadcaster.hasPublishers) {
140
142
  try {
141
143
  await this.wda.proxy.command('/wda/video/stop', 'POST', {});
142
144
  } catch {}
143
- await nativeScreenRecordingCommands.cleanupNativeRecordedVideos.bind(this)(
144
- this._recordedVideoIds
145
- );
145
+ await this._videoChunksBroadcaster.shutdown(5000);
146
146
  }
147
147
  await this.wda.stopSession();
148
148
 
@@ -325,7 +325,8 @@ export const executeMethodMap = {
325
325
  'method',
326
326
  'headers',
327
327
  'fileFieldName',
328
- 'formFields'
328
+ 'formFields',
329
+ 'ignorePayload',
329
330
  ],
330
331
  },
331
332
  },
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "appium-mac2-driver",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "appium-mac2-driver",
9
- "version": "2.1.0",
9
+ "version": "2.2.0",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "@appium/strongbox": "^0.x",
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "mac",
7
7
  "XCTest"
8
8
  ],
9
- "version": "2.1.0",
9
+ "version": "2.2.0",
10
10
  "author": "Appium Contributors",
11
11
  "license": "Apache-2.0",
12
12
  "repository": {