appium-xcuitest-driver 12.1.1 → 12.1.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/helpers/mjpeg.d.ts +15 -1
- package/build/lib/commands/helpers/mjpeg.d.ts.map +1 -1
- package/build/lib/commands/helpers/mjpeg.js +26 -6
- package/build/lib/commands/helpers/mjpeg.js.map +1 -1
- package/build/lib/commands/navigation.d.ts +3 -2
- package/build/lib/commands/navigation.d.ts.map +1 -1
- package/build/lib/commands/navigation.js +4 -2
- package/build/lib/commands/navigation.js.map +1 -1
- package/lib/commands/helpers/mjpeg.ts +27 -6
- package/lib/commands/navigation.ts +5 -3
- package/npm-shrinkwrap.json +52 -43
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## [12.1.3](https://github.com/appium/appium-xcuitest-driver/compare/v12.1.2...v12.1.3) (2026-07-31)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* Make closeWindow return remaining window handles per W3C spec ([#2931](https://github.com/appium/appium-xcuitest-driver/issues/2931)) ([4687938](https://github.com/appium/appium-xcuitest-driver/commit/46879386d3d2b06bba1992db412ba73e2ee3b391))
|
|
6
|
+
|
|
7
|
+
## [12.1.2](https://github.com/appium/appium-xcuitest-driver/compare/v12.1.1...v12.1.2) (2026-07-30)
|
|
8
|
+
|
|
9
|
+
### Miscellaneous Chores
|
|
10
|
+
|
|
11
|
+
* Harden MJPEG frame parsing and stream startup ([#2927](https://github.com/appium/appium-xcuitest-driver/issues/2927)) ([36bf6a0](https://github.com/appium/appium-xcuitest-driver/commit/36bf6a00f63265cd54b561e71ddc2bdae25da91e))
|
|
12
|
+
|
|
1
13
|
## [12.1.1](https://github.com/appium/appium-xcuitest-driver/compare/v12.1.0...v12.1.1) (2026-07-29)
|
|
2
14
|
|
|
3
15
|
### Miscellaneous Chores
|
|
@@ -1,5 +1,19 @@
|
|
|
1
|
-
import { Writable, type WritableOptions } from 'node:stream';
|
|
1
|
+
import { Transform, Writable, type TransformCallback, type WritableOptions } from 'node:stream';
|
|
2
2
|
import type { XCUITestDriver } from '../../driver.js';
|
|
3
|
+
/**
|
|
4
|
+
* Extracts individual JPEG frames out of a multipart MJPEG-over-HTTP byte stream by
|
|
5
|
+
* scanning for JPEG start/end-of-image markers and the multipart `Content-Length` header.
|
|
6
|
+
*/
|
|
7
|
+
export declare class MjpegFrameParser extends Transform {
|
|
8
|
+
private buffer;
|
|
9
|
+
private expectedLength;
|
|
10
|
+
private bytesWritten;
|
|
11
|
+
private isReading;
|
|
12
|
+
_transform(chunk: Buffer, _encoding: BufferEncoding, callback: TransformCallback): void;
|
|
13
|
+
private startFrame;
|
|
14
|
+
private appendChunk;
|
|
15
|
+
private emitFrame;
|
|
16
|
+
}
|
|
3
17
|
/**
|
|
4
18
|
* Connects to an MJPEG-over-HTTP stream and keeps track of the last JPEG frame received,
|
|
5
19
|
* so that it can be used as a cheap, low-latency screenshot source.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mjpeg.d.ts","sourceRoot":"","sources":["../../../../lib/commands/helpers/mjpeg.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"mjpeg.d.ts","sourceRoot":"","sources":["../../../../lib/commands/helpers/mjpeg.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAiB,KAAK,iBAAiB,EAAE,KAAK,eAAe,EAAC,MAAM,aAAa,CAAC;AAM7G,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,iBAAiB,CAAC;AAUpD;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,SAAS;IAC7C,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,cAAc,CAAK;IAC3B,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,SAAS,CAAS;IAG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AC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CA0BnF"}
|
|
@@ -11,7 +11,7 @@ const CONTENT_LENGTH_RE = /Content-Length:\s*(\d+)/i;
|
|
|
11
11
|
* Extracts individual JPEG frames out of a multipart MJPEG-over-HTTP byte stream by
|
|
12
12
|
* scanning for JPEG start/end-of-image markers and the multipart `Content-Length` header.
|
|
13
13
|
*/
|
|
14
|
-
class MjpegFrameParser extends Transform {
|
|
14
|
+
export class MjpegFrameParser extends Transform {
|
|
15
15
|
buffer = null;
|
|
16
16
|
expectedLength = 0;
|
|
17
17
|
bytesWritten = 0;
|
|
@@ -22,7 +22,7 @@ class MjpegFrameParser extends Transform {
|
|
|
22
22
|
const endIdx = chunk.indexOf(JPEG_EOI);
|
|
23
23
|
const lengthMatch = CONTENT_LENGTH_RE.exec(chunk.toString('latin1'));
|
|
24
24
|
if (this.buffer && (this.isReading || startIdx > -1)) {
|
|
25
|
-
this.appendChunk(chunk,
|
|
25
|
+
this.appendChunk(chunk, endIdx);
|
|
26
26
|
}
|
|
27
27
|
if (lengthMatch) {
|
|
28
28
|
this.startFrame(Number(lengthMatch[1]), chunk, startIdx, endIdx);
|
|
@@ -50,15 +50,19 @@ class MjpegFrameParser extends Transform {
|
|
|
50
50
|
this.isReading = true;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
appendChunk(chunk,
|
|
53
|
+
appendChunk(chunk, end) {
|
|
54
54
|
if (!this.buffer) {
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
|
-
|
|
57
|
+
// We are continuing a frame that is already open, so the whole chunk belongs to it
|
|
58
|
+
// and must be copied starting at offset 0. A JPEG SOI marker found anywhere in this
|
|
59
|
+
// chunk can only belong to the *next* frame (it necessarily comes after our own EOI),
|
|
60
|
+
// so it must never be used as the copy start here, or the current frame's tail bytes
|
|
61
|
+
// between offset 0 and that marker would be skipped, truncating it.
|
|
58
62
|
const copyEnd = end > -1 ? end + JPEG_EOI.length : chunk.length;
|
|
59
63
|
// Buffer.copy() silently truncates if the destination has less room than requested,
|
|
60
64
|
// so bytesWritten must track what was actually copied, not the requested range size.
|
|
61
|
-
this.bytesWritten += chunk.copy(this.buffer, this.bytesWritten,
|
|
65
|
+
this.bytesWritten += chunk.copy(this.buffer, this.bytesWritten, 0, copyEnd);
|
|
62
66
|
if (end > -1 || this.bytesWritten === this.expectedLength) {
|
|
63
67
|
this.emitFrame();
|
|
64
68
|
}
|
|
@@ -69,8 +73,17 @@ class MjpegFrameParser extends Transform {
|
|
|
69
73
|
emitFrame() {
|
|
70
74
|
this.isReading = false;
|
|
71
75
|
if (this.buffer) {
|
|
72
|
-
|
|
76
|
+
// Only push what was actually copied: the buffer is allocated to `expectedLength`
|
|
77
|
+
// up front, so pushing it as-is would leak trailing zero bytes whenever fewer
|
|
78
|
+
// bytes were actually written (e.g. a mismatched/truncated Content-Length).
|
|
79
|
+
this.push(this.buffer.subarray(0, this.bytesWritten));
|
|
73
80
|
}
|
|
81
|
+
// Clear the frame state so an unrelated later chunk (e.g. one with a JPEG SOI
|
|
82
|
+
// marker but no Content-Length header) cannot be appended onto a buffer that
|
|
83
|
+
// has already been pushed downstream.
|
|
84
|
+
this.buffer = null;
|
|
85
|
+
this.expectedLength = 0;
|
|
86
|
+
this.bytesWritten = 0;
|
|
74
87
|
}
|
|
75
88
|
}
|
|
76
89
|
let sharpModule = null;
|
|
@@ -189,6 +202,8 @@ export class MJpegStream extends Writable {
|
|
|
189
202
|
const onClose = () => {
|
|
190
203
|
log.debug(`The connection to MJPEG server at ${url} has been closed`);
|
|
191
204
|
this.lastChunk = null;
|
|
205
|
+
// No-op if start() has already resolved; only rejects a still-pending start().
|
|
206
|
+
this.registerStartFailure?.(new Error(`The connection to the MJPEG stream at ${url} has been closed before any frame was received`));
|
|
192
207
|
};
|
|
193
208
|
let timeoutId;
|
|
194
209
|
const startPromise = new Promise((resolve, reject) => {
|
|
@@ -204,6 +219,11 @@ export class MJpegStream extends Writable {
|
|
|
204
219
|
try {
|
|
205
220
|
await startPromise;
|
|
206
221
|
}
|
|
222
|
+
catch (err) {
|
|
223
|
+
// Do not leak the underlying HTTP connection/pipes if we never reached a usable state.
|
|
224
|
+
this.stop();
|
|
225
|
+
throw err;
|
|
226
|
+
}
|
|
207
227
|
finally {
|
|
208
228
|
clearTimeout(timeoutId);
|
|
209
229
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mjpeg.js","sourceRoot":"","sources":["../../../../lib/commands/helpers/mjpeg.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,QAAQ,EAA8D,MAAM,aAAa,CAAC;AAE7G,OAAO,EAAC,MAAM,EAAC,MAAM,mBAAmB,CAAC;AACzC,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,MAAM,GAAG,GAAG,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AAEtC,MAAM,yBAAyB,GAAG,KAAK,CAAC;AACxC,MAAM,yBAAyB,GAAG,IAAI,CAAC;AACvC,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAC3C,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAC3C,MAAM,iBAAiB,GAAG,0BAA0B,CAAC;AAErD;;;GAGG;AACH,MAAM,gBAAiB,SAAQ,SAAS;
|
|
1
|
+
{"version":3,"file":"mjpeg.js","sourceRoot":"","sources":["../../../../lib/commands/helpers/mjpeg.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,QAAQ,EAA8D,MAAM,aAAa,CAAC;AAE7G,OAAO,EAAC,MAAM,EAAC,MAAM,mBAAmB,CAAC;AACzC,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,MAAM,GAAG,GAAG,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AAEtC,M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CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,MAAM,CAAC,IAAI,CAAC,eAAe,KAAK,SAAS,EAAE,CAAC;YAC9C,MAAM,CAAC,GAAG,CAAC,IAAI,CACb,kCAAkC,yBAAyB,sBAAsB,yBAAyB,IAAI;gBAC5G,gGAAgG;gBAChG,mFAAmF,CACtF,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,GAAG,CAAC,KAAK,CAAE,KAAe,CAAC,KAAK,CAAC,CAAC;YACzC,MAAM,IAAI,KAAK,CACb,4EAA4E,eAAe,GAAG;gBAC5F,oEAAoE,eAAe,IAAI;gBACvF,mBAAmB,KAAK,EAAE,EAC5B,EAAC,KAAK,EAAE,KAAK,EAAC,CACf,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -10,9 +10,10 @@ export declare function forward(this: XCUITestDriver): Promise<void>;
|
|
|
10
10
|
/**
|
|
11
11
|
* Closes the current window in a web context.
|
|
12
12
|
*
|
|
13
|
-
* @returns Promise
|
|
13
|
+
* @returns Promise resolving to the handles of the windows that remain open,
|
|
14
|
+
* as required by https://www.w3.org/TR/webdriver2/#close-window
|
|
14
15
|
*/
|
|
15
|
-
export declare function closeWindow(this: XCUITestDriver): Promise<
|
|
16
|
+
export declare function closeWindow(this: XCUITestDriver): Promise<string[]>;
|
|
16
17
|
/**
|
|
17
18
|
* Opens the given URL with the default application assigned to handle it based on the URL
|
|
18
19
|
* scheme, or the application provided as an optional parameter
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../../lib/commands/navigation.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,cAAc,CAAC;AAOjD;;GAEG;AACH,wBAAsB,IAAI,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAM9D;AAED;;GAEG;AACH,wBAAsB,OAAO,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAMjE;AAED
|
|
1
|
+
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../../lib/commands/navigation.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,cAAc,CAAC;AAOjD;;GAEG;AACH,wBAAsB,IAAI,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAM9D;AAED;;GAEG;AACH,wBAAsB,OAAO,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAMjE;AAED;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAuBzE;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAKxG;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAoCpE"}
|
|
@@ -28,7 +28,8 @@ export async function forward() {
|
|
|
28
28
|
/**
|
|
29
29
|
* Closes the current window in a web context.
|
|
30
30
|
*
|
|
31
|
-
* @returns Promise
|
|
31
|
+
* @returns Promise resolving to the handles of the windows that remain open,
|
|
32
|
+
* as required by https://www.w3.org/TR/webdriver2/#close-window
|
|
32
33
|
*/
|
|
33
34
|
export async function closeWindow() {
|
|
34
35
|
if (!this.isWebContext()) {
|
|
@@ -39,7 +40,7 @@ export async function closeWindow() {
|
|
|
39
40
|
const script = `setTimeout(function () {window.open('','_self').close();}, 0); return true;`;
|
|
40
41
|
const context = this.curContext;
|
|
41
42
|
try {
|
|
42
|
-
|
|
43
|
+
await this.executeAtom('execute_script', [script, []], true);
|
|
43
44
|
}
|
|
44
45
|
finally {
|
|
45
46
|
// wait for the window to successfully change...
|
|
@@ -53,6 +54,7 @@ export async function closeWindow() {
|
|
|
53
54
|
this.log.debug('Context has not yet been changed after closing window. Continuing...');
|
|
54
55
|
}
|
|
55
56
|
}
|
|
57
|
+
return await this.getWindowHandles();
|
|
56
58
|
}
|
|
57
59
|
/**
|
|
58
60
|
* Opens the given URL with the default application assigned to handle it based on the URL
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.js","sourceRoot":"","sources":["../../../lib/commands/navigation.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,MAAM,EAAC,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAC,gBAAgB,EAAC,MAAM,UAAU,CAAC;AAG1C,OAAO,EAAC,MAAM,EAAC,MAAM,mBAAmB,CAAC;AAEzC,uDAAuD;AACvD,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAClC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAElC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,IAAI;IACxB,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,CAAC;QACzB,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;IAC1B,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO;IAC3B,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,CAAC;QACzB,2BAA2B;QAC3B,OAAO;IACT,CAAC;IACD,MAAM,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;AACrC,CAAC;AAED
|
|
1
|
+
{"version":3,"file":"navigation.js","sourceRoot":"","sources":["../../../lib/commands/navigation.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,MAAM,EAAC,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAC,gBAAgB,EAAC,MAAM,UAAU,CAAC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AS,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QACzB,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,wEAAwE,CAAC,CAAC;YACzF,SAAS,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;QAC7B,CAAC;QAED,MAAM,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC;IAAC,OAAO,GAAQ,EAAE,CAAC;QAClB,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,kDAAkD,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;IAClF,CAAC;AACH,CAAC"}
|
|
@@ -18,7 +18,7 @@ const CONTENT_LENGTH_RE = /Content-Length:\s*(\d+)/i;
|
|
|
18
18
|
* Extracts individual JPEG frames out of a multipart MJPEG-over-HTTP byte stream by
|
|
19
19
|
* scanning for JPEG start/end-of-image markers and the multipart `Content-Length` header.
|
|
20
20
|
*/
|
|
21
|
-
class MjpegFrameParser extends Transform {
|
|
21
|
+
export class MjpegFrameParser extends Transform {
|
|
22
22
|
private buffer: Buffer | null = null;
|
|
23
23
|
private expectedLength = 0;
|
|
24
24
|
private bytesWritten = 0;
|
|
@@ -31,7 +31,7 @@ class MjpegFrameParser extends Transform {
|
|
|
31
31
|
const lengthMatch = CONTENT_LENGTH_RE.exec(chunk.toString('latin1'));
|
|
32
32
|
|
|
33
33
|
if (this.buffer && (this.isReading || startIdx > -1)) {
|
|
34
|
-
this.appendChunk(chunk,
|
|
34
|
+
this.appendChunk(chunk, endIdx);
|
|
35
35
|
}
|
|
36
36
|
if (lengthMatch) {
|
|
37
37
|
this.startFrame(Number(lengthMatch[1]), chunk, startIdx, endIdx);
|
|
@@ -62,15 +62,19 @@ class MjpegFrameParser extends Transform {
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
private appendChunk(chunk: Buffer,
|
|
65
|
+
private appendChunk(chunk: Buffer, end: number): void {
|
|
66
66
|
if (!this.buffer) {
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
|
-
|
|
69
|
+
// We are continuing a frame that is already open, so the whole chunk belongs to it
|
|
70
|
+
// and must be copied starting at offset 0. A JPEG SOI marker found anywhere in this
|
|
71
|
+
// chunk can only belong to the *next* frame (it necessarily comes after our own EOI),
|
|
72
|
+
// so it must never be used as the copy start here, or the current frame's tail bytes
|
|
73
|
+
// between offset 0 and that marker would be skipped, truncating it.
|
|
70
74
|
const copyEnd = end > -1 ? end + JPEG_EOI.length : chunk.length;
|
|
71
75
|
// Buffer.copy() silently truncates if the destination has less room than requested,
|
|
72
76
|
// so bytesWritten must track what was actually copied, not the requested range size.
|
|
73
|
-
this.bytesWritten += chunk.copy(this.buffer, this.bytesWritten,
|
|
77
|
+
this.bytesWritten += chunk.copy(this.buffer, this.bytesWritten, 0, copyEnd);
|
|
74
78
|
|
|
75
79
|
if (end > -1 || this.bytesWritten === this.expectedLength) {
|
|
76
80
|
this.emitFrame();
|
|
@@ -82,8 +86,17 @@ class MjpegFrameParser extends Transform {
|
|
|
82
86
|
private emitFrame(): void {
|
|
83
87
|
this.isReading = false;
|
|
84
88
|
if (this.buffer) {
|
|
85
|
-
|
|
89
|
+
// Only push what was actually copied: the buffer is allocated to `expectedLength`
|
|
90
|
+
// up front, so pushing it as-is would leak trailing zero bytes whenever fewer
|
|
91
|
+
// bytes were actually written (e.g. a mismatched/truncated Content-Length).
|
|
92
|
+
this.push(this.buffer.subarray(0, this.bytesWritten));
|
|
86
93
|
}
|
|
94
|
+
// Clear the frame state so an unrelated later chunk (e.g. one with a JPEG SOI
|
|
95
|
+
// marker but no Content-Length header) cannot be appended onto a buffer that
|
|
96
|
+
// has already been pushed downstream.
|
|
97
|
+
this.buffer = null;
|
|
98
|
+
this.expectedLength = 0;
|
|
99
|
+
this.bytesWritten = 0;
|
|
87
100
|
}
|
|
88
101
|
}
|
|
89
102
|
|
|
@@ -213,6 +226,10 @@ export class MJpegStream extends Writable {
|
|
|
213
226
|
const onClose = () => {
|
|
214
227
|
log.debug(`The connection to MJPEG server at ${url} has been closed`);
|
|
215
228
|
this.lastChunk = null;
|
|
229
|
+
// No-op if start() has already resolved; only rejects a still-pending start().
|
|
230
|
+
this.registerStartFailure?.(
|
|
231
|
+
new Error(`The connection to the MJPEG stream at ${url} has been closed before any frame was received`),
|
|
232
|
+
);
|
|
216
233
|
};
|
|
217
234
|
|
|
218
235
|
let timeoutId: NodeJS.Timeout | undefined;
|
|
@@ -233,6 +250,10 @@ export class MJpegStream extends Writable {
|
|
|
233
250
|
|
|
234
251
|
try {
|
|
235
252
|
await startPromise;
|
|
253
|
+
} catch (err) {
|
|
254
|
+
// Do not leak the underlying HTTP connection/pipes if we never reached a usable state.
|
|
255
|
+
this.stop();
|
|
256
|
+
throw err;
|
|
236
257
|
} finally {
|
|
237
258
|
clearTimeout(timeoutId);
|
|
238
259
|
}
|
|
@@ -34,9 +34,10 @@ export async function forward(this: XCUITestDriver): Promise<void> {
|
|
|
34
34
|
/**
|
|
35
35
|
* Closes the current window in a web context.
|
|
36
36
|
*
|
|
37
|
-
* @returns Promise
|
|
37
|
+
* @returns Promise resolving to the handles of the windows that remain open,
|
|
38
|
+
* as required by https://www.w3.org/TR/webdriver2/#close-window
|
|
38
39
|
*/
|
|
39
|
-
export async function closeWindow(this: XCUITestDriver): Promise<
|
|
40
|
+
export async function closeWindow(this: XCUITestDriver): Promise<string[]> {
|
|
40
41
|
if (!this.isWebContext()) {
|
|
41
42
|
throw new errors.NotImplementedError();
|
|
42
43
|
}
|
|
@@ -46,7 +47,7 @@ export async function closeWindow(this: XCUITestDriver): Promise<any> {
|
|
|
46
47
|
const script = `setTimeout(function () {window.open('','_self').close();}, 0); return true;`;
|
|
47
48
|
const context = this.curContext;
|
|
48
49
|
try {
|
|
49
|
-
|
|
50
|
+
await this.executeAtom('execute_script', [script, []], true);
|
|
50
51
|
} finally {
|
|
51
52
|
// wait for the window to successfully change...
|
|
52
53
|
try {
|
|
@@ -58,6 +59,7 @@ export async function closeWindow(this: XCUITestDriver): Promise<any> {
|
|
|
58
59
|
this.log.debug('Context has not yet been changed after closing window. Continuing...');
|
|
59
60
|
}
|
|
60
61
|
}
|
|
62
|
+
return await this.getWindowHandles();
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
/**
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "appium-xcuitest-driver",
|
|
3
|
-
"version": "12.1.
|
|
3
|
+
"version": "12.1.3",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "appium-xcuitest-driver",
|
|
9
|
-
"version": "12.1.
|
|
9
|
+
"version": "12.1.3",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@appium/css-locator-to-native": "^1.0.1",
|
|
@@ -109,6 +109,18 @@
|
|
|
109
109
|
"npm": ">=10"
|
|
110
110
|
}
|
|
111
111
|
},
|
|
112
|
+
"node_modules/@appium/base-driver/node_modules/axios": {
|
|
113
|
+
"version": "1.18.1",
|
|
114
|
+
"resolved": "https://registry.npmjs.org/axios/-/axios-1.18.1.tgz",
|
|
115
|
+
"integrity": "sha512-3nTvFlvpn9Zu/RkHUqtc7/+al4UpRW5az71ap5zccp6e8RAYEzhMTecX8Dz1wWDYrPpUoB1HAQEGEAEvUr7S9g==",
|
|
116
|
+
"license": "MIT",
|
|
117
|
+
"dependencies": {
|
|
118
|
+
"follow-redirects": "^1.16.0",
|
|
119
|
+
"form-data": "^4.0.5",
|
|
120
|
+
"https-proxy-agent": "^5.0.1",
|
|
121
|
+
"proxy-from-env": "^2.1.0"
|
|
122
|
+
}
|
|
123
|
+
},
|
|
112
124
|
"node_modules/@appium/css-locator-to-native": {
|
|
113
125
|
"version": "1.0.6",
|
|
114
126
|
"resolved": "https://registry.npmjs.org/@appium/css-locator-to-native/-/css-locator-to-native-1.0.6.tgz",
|
|
@@ -253,6 +265,18 @@
|
|
|
253
265
|
"npm": ">=10"
|
|
254
266
|
}
|
|
255
267
|
},
|
|
268
|
+
"node_modules/@appium/support/node_modules/axios": {
|
|
269
|
+
"version": "1.18.1",
|
|
270
|
+
"resolved": "https://registry.npmjs.org/axios/-/axios-1.18.1.tgz",
|
|
271
|
+
"integrity": "sha512-3nTvFlvpn9Zu/RkHUqtc7/+al4UpRW5az71ap5zccp6e8RAYEzhMTecX8Dz1wWDYrPpUoB1HAQEGEAEvUr7S9g==",
|
|
272
|
+
"license": "MIT",
|
|
273
|
+
"dependencies": {
|
|
274
|
+
"follow-redirects": "^1.16.0",
|
|
275
|
+
"form-data": "^4.0.5",
|
|
276
|
+
"https-proxy-agent": "^5.0.1",
|
|
277
|
+
"proxy-from-env": "^2.1.0"
|
|
278
|
+
}
|
|
279
|
+
},
|
|
256
280
|
"node_modules/@appium/support/node_modules/teen_process": {
|
|
257
281
|
"version": "4.1.9",
|
|
258
282
|
"resolved": "https://registry.npmjs.org/teen_process/-/teen_process-4.1.9.tgz",
|
|
@@ -472,9 +496,9 @@
|
|
|
472
496
|
}
|
|
473
497
|
},
|
|
474
498
|
"node_modules/appium-ios-device": {
|
|
475
|
-
"version": "3.1.
|
|
476
|
-
"resolved": "https://registry.npmjs.org/appium-ios-device/-/appium-ios-device-3.1.
|
|
477
|
-
"integrity": "sha512-
|
|
499
|
+
"version": "3.1.20",
|
|
500
|
+
"resolved": "https://registry.npmjs.org/appium-ios-device/-/appium-ios-device-3.1.20.tgz",
|
|
501
|
+
"integrity": "sha512-ZF2HveeCNJ4kTd13Yf1HaNH+CZiIp4Vn3Tbv0efAd0fRTgr7X/PvFjBUZQ5iSvZ4vTufgmzMBYvZ9FVoWp7qtg==",
|
|
478
502
|
"license": "Apache-2.0",
|
|
479
503
|
"dependencies": {
|
|
480
504
|
"@appium/support": "^7.2.2",
|
|
@@ -529,9 +553,9 @@
|
|
|
529
553
|
}
|
|
530
554
|
},
|
|
531
555
|
"node_modules/appium-ios-simulator": {
|
|
532
|
-
"version": "9.1.
|
|
533
|
-
"resolved": "https://registry.npmjs.org/appium-ios-simulator/-/appium-ios-simulator-9.1.
|
|
534
|
-
"integrity": "sha512-
|
|
556
|
+
"version": "9.1.2",
|
|
557
|
+
"resolved": "https://registry.npmjs.org/appium-ios-simulator/-/appium-ios-simulator-9.1.2.tgz",
|
|
558
|
+
"integrity": "sha512-IVZKABOIvY8NZhYmNHVFc56MQhpoK1UXRSuzXrYW2jFu7jkb6n2szcfDefU4JS4rFOJOaA4LqOAQ9mcUUv+PSg==",
|
|
535
559
|
"license": "Apache-2.0",
|
|
536
560
|
"dependencies": {
|
|
537
561
|
"@appium/support": "^7.2.5",
|
|
@@ -549,17 +573,16 @@
|
|
|
549
573
|
}
|
|
550
574
|
},
|
|
551
575
|
"node_modules/appium-ios-tuntap": {
|
|
552
|
-
"version": "1.2.
|
|
553
|
-
"resolved": "https://registry.npmjs.org/appium-ios-tuntap/-/appium-ios-tuntap-1.2.
|
|
554
|
-
"integrity": "sha512-
|
|
576
|
+
"version": "1.2.2",
|
|
577
|
+
"resolved": "https://registry.npmjs.org/appium-ios-tuntap/-/appium-ios-tuntap-1.2.2.tgz",
|
|
578
|
+
"integrity": "sha512-h1T436MwEJ2Es++vg2ueCxpJfLIT53gYlnHtyiUFUWAdFPnWXEkeC0SexQzvinFaXpkdX0H8ytt0R1CiRdhc9Q==",
|
|
555
579
|
"hasInstallScript": true,
|
|
556
580
|
"license": "Apache-2.0",
|
|
557
581
|
"optional": true,
|
|
558
582
|
"dependencies": {
|
|
559
583
|
"@appium/support": "^7.2.0",
|
|
560
584
|
"node-addon-api": "^8.5.0",
|
|
561
|
-
"node-gyp-build": "^4.8.4"
|
|
562
|
-
"typescript": "^6.0.2"
|
|
585
|
+
"node-gyp-build": "^4.8.4"
|
|
563
586
|
},
|
|
564
587
|
"engines": {
|
|
565
588
|
"node": "^20.19.0 || ^22.12.0 || >=24.0.0",
|
|
@@ -588,9 +611,9 @@
|
|
|
588
611
|
}
|
|
589
612
|
},
|
|
590
613
|
"node_modules/appium-webdriveragent": {
|
|
591
|
-
"version": "16.0
|
|
592
|
-
"resolved": "https://registry.npmjs.org/appium-webdriveragent/-/appium-webdriveragent-16.0.
|
|
593
|
-
"integrity": "sha512-
|
|
614
|
+
"version": "16.1.0",
|
|
615
|
+
"resolved": "https://registry.npmjs.org/appium-webdriveragent/-/appium-webdriveragent-16.1.0.tgz",
|
|
616
|
+
"integrity": "sha512-RuH209vkPc8wlV4oRZqiSkSHpcOsEyJ58uOs0APBme5IGIqftRmE4je8HBEEokhgFXrlb+gJUcB85jJQwCnJbw==",
|
|
594
617
|
"license": "Apache-2.0",
|
|
595
618
|
"dependencies": {
|
|
596
619
|
"@appium/base-driver": "^10.3.0",
|
|
@@ -656,9 +679,9 @@
|
|
|
656
679
|
"license": "MIT"
|
|
657
680
|
},
|
|
658
681
|
"node_modules/asyncbox": {
|
|
659
|
-
"version": "6.4.
|
|
660
|
-
"resolved": "https://registry.npmjs.org/asyncbox/-/asyncbox-6.4.
|
|
661
|
-
"integrity": "sha512-
|
|
682
|
+
"version": "6.4.2",
|
|
683
|
+
"resolved": "https://registry.npmjs.org/asyncbox/-/asyncbox-6.4.2.tgz",
|
|
684
|
+
"integrity": "sha512-CXEnvX5i4UtAdu3Egtqn5At9C1O3bIqtS3EAQGz8bA5H11cvu9eO17IxOWiM8Q8DUFk9sD251s9vsAXFKXXFgg==",
|
|
662
685
|
"license": "Apache-2.0",
|
|
663
686
|
"dependencies": {
|
|
664
687
|
"p-limit": "^7.2.0"
|
|
@@ -675,13 +698,13 @@
|
|
|
675
698
|
"license": "MIT"
|
|
676
699
|
},
|
|
677
700
|
"node_modules/axios": {
|
|
678
|
-
"version": "1.
|
|
679
|
-
"resolved": "https://registry.npmjs.org/axios/-/axios-1.
|
|
680
|
-
"integrity": "sha512-
|
|
701
|
+
"version": "1.19.0",
|
|
702
|
+
"resolved": "https://registry.npmjs.org/axios/-/axios-1.19.0.tgz",
|
|
703
|
+
"integrity": "sha512-ht/iuYZXEjFxLH/Hkezgd7m6JKlHHXEUSneaDz8uZe1Gj5QZtCnpyDsckvAiEnT89OEbCLmnte4R4sn7P0EKFw==",
|
|
681
704
|
"license": "MIT",
|
|
682
705
|
"dependencies": {
|
|
683
706
|
"follow-redirects": "^1.16.0",
|
|
684
|
-
"form-data": "^4.0.
|
|
707
|
+
"form-data": "^4.0.6",
|
|
685
708
|
"https-proxy-agent": "^5.0.1",
|
|
686
709
|
"proxy-from-env": "^2.1.0"
|
|
687
710
|
}
|
|
@@ -882,9 +905,9 @@
|
|
|
882
905
|
}
|
|
883
906
|
},
|
|
884
907
|
"node_modules/brace-expansion": {
|
|
885
|
-
"version": "5.0.
|
|
886
|
-
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.
|
|
887
|
-
"integrity": "sha512-
|
|
908
|
+
"version": "5.0.9",
|
|
909
|
+
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.9.tgz",
|
|
910
|
+
"integrity": "sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg==",
|
|
888
911
|
"license": "MIT",
|
|
889
912
|
"dependencies": {
|
|
890
913
|
"balanced-match": "^4.0.2"
|
|
@@ -2412,9 +2435,9 @@
|
|
|
2412
2435
|
}
|
|
2413
2436
|
},
|
|
2414
2437
|
"node_modules/node-addon-api": {
|
|
2415
|
-
"version": "8.9.
|
|
2416
|
-
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-8.9.
|
|
2417
|
-
"integrity": "sha512-
|
|
2438
|
+
"version": "8.9.1",
|
|
2439
|
+
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-8.9.1.tgz",
|
|
2440
|
+
"integrity": "sha512-4eUQWVPCUUUiBjLnHS3cXWeC6ryoPUc0U3rP7IuzapoGbzMqd/r6KKO0clr0b+snQhsrueFEhCZDdK+LK7hxKg==",
|
|
2418
2441
|
"license": "MIT",
|
|
2419
2442
|
"optional": true,
|
|
2420
2443
|
"engines": {
|
|
@@ -3573,20 +3596,6 @@
|
|
|
3573
3596
|
"url": "https://opencollective.com/express"
|
|
3574
3597
|
}
|
|
3575
3598
|
},
|
|
3576
|
-
"node_modules/typescript": {
|
|
3577
|
-
"version": "6.0.3",
|
|
3578
|
-
"resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz",
|
|
3579
|
-
"integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==",
|
|
3580
|
-
"license": "Apache-2.0",
|
|
3581
|
-
"optional": true,
|
|
3582
|
-
"bin": {
|
|
3583
|
-
"tsc": "bin/tsc",
|
|
3584
|
-
"tsserver": "bin/tsserver"
|
|
3585
|
-
},
|
|
3586
|
-
"engines": {
|
|
3587
|
-
"node": ">=14.17"
|
|
3588
|
-
}
|
|
3589
|
-
},
|
|
3590
3599
|
"node_modules/unorm": {
|
|
3591
3600
|
"version": "1.6.0",
|
|
3592
3601
|
"resolved": "https://registry.npmjs.org/unorm/-/unorm-1.6.0.tgz",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "appium-xcuitest-driver",
|
|
3
|
-
"version": "12.1.
|
|
3
|
+
"version": "12.1.3",
|
|
4
4
|
"description": "Appium driver for iOS using XCUITest for backend",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"appium",
|
|
@@ -57,14 +57,14 @@
|
|
|
57
57
|
"prepare": "npm run rebuild",
|
|
58
58
|
"rebuild": "npm run clean; npm run build",
|
|
59
59
|
"test": "node --enable-source-maps --test --test-force-exit --test-timeout=60000 \"./build/test/unit/**/*.spec.js\"",
|
|
60
|
-
"e2e-test": "node --enable-source-maps --test --test-force-exit --test-
|
|
61
|
-
"e2e-test:basic": "node --enable-source-maps --test --test-force-exit --test-
|
|
62
|
-
"e2e-test:device": "node --enable-source-maps --test --test-force-exit --test-
|
|
63
|
-
"e2e-test:driver": "node --enable-source-maps --test --test-force-exit --test-
|
|
64
|
-
"e2e-test:long": "node --enable-source-maps --test --test-force-exit --test-
|
|
65
|
-
"e2e-test:parallel": "node --enable-source-maps --test --test-force-exit --test-
|
|
66
|
-
"e2e-test:web": "node --enable-source-maps --test --test-force-exit --test-
|
|
67
|
-
"e2e-test:native-web-tap": "node --enable-source-maps --test --test-force-exit --test-
|
|
60
|
+
"e2e-test": "node --enable-source-maps --test --test-force-exit --test-concurrency=1 \"./build/test/functional/**/*.spec.js\"",
|
|
61
|
+
"e2e-test:basic": "node --enable-source-maps --test --test-force-exit --test-concurrency=1 \"./build/test/functional/basic/**/*.spec.js\"",
|
|
62
|
+
"e2e-test:device": "node --enable-source-maps --test --test-force-exit --test-concurrency=1 \"./build/test/functional/device/**/*.spec.js\"",
|
|
63
|
+
"e2e-test:driver": "node --enable-source-maps --test --test-force-exit --test-concurrency=1 \"./build/test/functional/driver/**/*.spec.js\"",
|
|
64
|
+
"e2e-test:long": "node --enable-source-maps --test --test-force-exit --test-concurrency=1 \"./build/test/functional/long/**/*.spec.js\"",
|
|
65
|
+
"e2e-test:parallel": "node --enable-source-maps --test --test-force-exit --test-concurrency=1 \"./build/test/functional/parallel/**/*.spec.js\"",
|
|
66
|
+
"e2e-test:web": "node --enable-source-maps --test --test-force-exit --test-concurrency=1 \"./build/test/functional/web/**/*.spec.js\"",
|
|
67
|
+
"e2e-test:native-web-tap": "node --enable-source-maps --test --test-force-exit --test-concurrency=1 \"./build/test/functional/web/safari-nativewebtap*.spec.js\"",
|
|
68
68
|
"start": "appium --relaxed-security --port 4567 --keep-alive-timeout 1200"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|