appium-xcuitest-driver 10.14.4 → 10.14.5
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 +6 -0
- package/build/lib/commands/battery.d.ts +4 -4
- package/build/lib/commands/battery.d.ts.map +1 -1
- package/build/lib/commands/battery.js +3 -7
- package/build/lib/commands/battery.js.map +1 -1
- package/build/lib/commands/clipboard.d.ts +9 -11
- package/build/lib/commands/clipboard.d.ts.map +1 -1
- package/build/lib/commands/clipboard.js +8 -13
- package/build/lib/commands/clipboard.js.map +1 -1
- package/build/lib/commands/increase-contrast.d.ts +10 -13
- package/build/lib/commands/increase-contrast.d.ts.map +1 -1
- package/build/lib/commands/increase-contrast.js +8 -16
- package/build/lib/commands/increase-contrast.js.map +1 -1
- package/build/lib/commands/lock.d.ts +6 -10
- package/build/lib/commands/lock.d.ts.map +1 -1
- package/build/lib/commands/lock.js +3 -10
- package/build/lib/commands/lock.js.map +1 -1
- package/build/lib/commands/memory.d.ts +4 -5
- package/build/lib/commands/memory.d.ts.map +1 -1
- package/build/lib/commands/memory.js +3 -8
- package/build/lib/commands/memory.js.map +1 -1
- package/build/lib/commands/pasteboard.d.ts +9 -10
- package/build/lib/commands/pasteboard.d.ts.map +1 -1
- package/build/lib/commands/pasteboard.js +8 -13
- package/build/lib/commands/pasteboard.js.map +1 -1
- package/lib/commands/{battery.js → battery.ts} +10 -12
- package/lib/commands/clipboard.ts +37 -0
- package/lib/commands/increase-contrast.ts +49 -0
- package/lib/commands/lock.ts +43 -0
- package/lib/commands/{memory.js → memory.ts} +9 -9
- package/lib/commands/pasteboard.ts +44 -0
- package/npm-shrinkwrap.json +29 -8
- package/package.json +1 -1
- package/lib/commands/clipboard.js +0 -35
- package/lib/commands/increase-contrast.js +0 -50
- package/lib/commands/lock.js +0 -46
- package/lib/commands/pasteboard.js +0 -43
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## [10.14.5](https://github.com/appium/appium-xcuitest-driver/compare/v10.14.4...v10.14.5) (2026-01-06)
|
|
2
|
+
|
|
3
|
+
### Miscellaneous Chores
|
|
4
|
+
|
|
5
|
+
* Migrate various commands to typescript (part 9) ([#2695](https://github.com/appium/appium-xcuitest-driver/issues/2695)) ([615b21f](https://github.com/appium/appium-xcuitest-driver/commit/615b21f166ad967e9cb6b3962c9dfed1c7b267e3))
|
|
6
|
+
|
|
1
7
|
## [10.14.4](https://github.com/appium/appium-xcuitest-driver/compare/v10.14.3...v10.14.4) (2026-01-05)
|
|
2
8
|
|
|
3
9
|
### Miscellaneous Chores
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import type { XCUITestDriver } from '../driver';
|
|
2
|
+
import type { BatteryInfo } from './types';
|
|
1
3
|
/**
|
|
2
4
|
* Reads the battery information from the device under test.
|
|
3
5
|
*
|
|
4
6
|
* This endpoint only returns reliable result on real devices.
|
|
5
7
|
*
|
|
6
|
-
* @returns
|
|
7
|
-
* @this {import('../driver').XCUITestDriver}
|
|
8
|
+
* @returns Battery information with advanced details
|
|
8
9
|
*/
|
|
9
|
-
export function mobileGetBatteryInfo(this:
|
|
10
|
+
export declare function mobileGetBatteryInfo(this: XCUITestDriver): Promise<BatteryInfo & {
|
|
10
11
|
advanced: Record<string, any>;
|
|
11
12
|
}>;
|
|
12
|
-
export type BatteryInfo = import("./types").BatteryInfo;
|
|
13
13
|
//# sourceMappingURL=battery.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"battery.d.ts","sourceRoot":"","sources":["../../../lib/commands/battery.
|
|
1
|
+
{"version":3,"file":"battery.d.ts","sourceRoot":"","sources":["../../../lib/commands/battery.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;AAEzC;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,WAAW,GAAG;IAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAAC,CAAC,CA2BxD"}
|
|
@@ -7,8 +7,7 @@ const utils_1 = require("../utils");
|
|
|
7
7
|
*
|
|
8
8
|
* This endpoint only returns reliable result on real devices.
|
|
9
9
|
*
|
|
10
|
-
* @returns
|
|
11
|
-
* @this {import('../driver').XCUITestDriver}
|
|
10
|
+
* @returns Battery information with advanced details
|
|
12
11
|
*/
|
|
13
12
|
async function mobileGetBatteryInfo() {
|
|
14
13
|
let batteryInfoFromShimService;
|
|
@@ -16,7 +15,7 @@ async function mobileGetBatteryInfo() {
|
|
|
16
15
|
let remoteXPCConnection;
|
|
17
16
|
try {
|
|
18
17
|
const { Services } = await import('appium-ios-remotexpc');
|
|
19
|
-
|
|
18
|
+
const { diagnosticsService, remoteXPC } = await Services.startDiagnosticsService(this.device.udid);
|
|
20
19
|
remoteXPCConnection = remoteXPC;
|
|
21
20
|
batteryInfoFromShimService = await diagnosticsService.ioregistry({
|
|
22
21
|
ioClass: 'IOPMPowerSource',
|
|
@@ -33,13 +32,10 @@ async function mobileGetBatteryInfo() {
|
|
|
33
32
|
}
|
|
34
33
|
}
|
|
35
34
|
}
|
|
36
|
-
const batteryInfoFromWda =
|
|
35
|
+
const batteryInfoFromWda = await this.proxyCommand('/wda/batteryInfo', 'GET');
|
|
37
36
|
return {
|
|
38
37
|
...batteryInfoFromWda,
|
|
39
38
|
advanced: batteryInfoFromShimService || {},
|
|
40
39
|
};
|
|
41
40
|
}
|
|
42
|
-
/**
|
|
43
|
-
* @typedef {import('./types').BatteryInfo} BatteryInfo
|
|
44
|
-
*/
|
|
45
41
|
//# sourceMappingURL=battery.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"battery.js","sourceRoot":"","sources":["../../../lib/commands/battery.
|
|
1
|
+
{"version":3,"file":"battery.js","sourceRoot":"","sources":["../../../lib/commands/battery.ts"],"names":[],"mappings":";;AAWA,oDA6BC;AAxCD,oCAA0C;AAI1C;;;;;;GAMG;AACI,KAAK,UAAU,oBAAoB;IAGxC,IAAI,0BAA2D,CAAC;IAChE,IAAI,IAAA,sBAAc,EAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,YAAY,EAAE,EAAE,CAAC;QACrD,IAAI,mBAAmB,CAAC;QACxB,IAAI,CAAC;YACH,MAAM,EAAC,QAAQ,EAAC,GAAG,MAAM,MAAM,CAAC,sBAAsB,CAAC,CAAC;YACxD,MAAM,EAAE,kBAAkB,EAAE,SAAS,EAAE,GAAG,MAAM,QAAQ,CAAC,uBAAuB,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YACnG,mBAAmB,GAAG,SAAS,CAAC;YAChC,0BAA0B,GAAG,MAAM,kBAAkB,CAAC,UAAU,CAAC;gBAC/D,OAAO,EAAE,iBAAiB;gBAC1B,aAAa,EAAE,IAAI;aACpB,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,uDAAuD,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;QACvF,CAAC;gBAAS,CAAC;YACT,IAAI,mBAAmB,EAAE,CAAC;gBACxB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,2CAA2C,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;gBAC7E,MAAM,mBAAmB,CAAC,KAAK,EAAE,CAAC;YACpC,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,kBAAkB,GAAG,MAAM,IAAI,CAAC,YAAY,CAAmB,kBAAkB,EAAE,KAAK,CAAC,CAAC;IAChG,OAAO;QACL,GAAG,kBAAkB;QACrB,QAAQ,EAAE,0BAA0B,IAAI,EAAE;KAC3C,CAAC;AACJ,CAAC"}
|
|
@@ -1,21 +1,19 @@
|
|
|
1
|
+
import type { XCUITestDriver } from '../driver';
|
|
1
2
|
/**
|
|
2
3
|
* Sets the primary clipboard's content on the device under test.
|
|
3
4
|
*
|
|
4
|
-
* @param
|
|
5
|
-
* @param
|
|
6
|
-
*
|
|
7
|
-
* @this {XCUITestDriver}
|
|
5
|
+
* @param content - The content to be set as base64 encoded string.
|
|
6
|
+
* @param contentType - The type of the content to set.
|
|
7
|
+
* Only `plaintext`, 'image' and 'url' are supported.
|
|
8
8
|
*/
|
|
9
|
-
export function setClipboard(this:
|
|
9
|
+
export declare function setClipboard(this: XCUITestDriver, content: string, contentType?: string): Promise<void>;
|
|
10
10
|
/**
|
|
11
11
|
* Gets the content of the primary clipboard on the device under test.
|
|
12
12
|
*
|
|
13
|
-
* @param
|
|
14
|
-
*
|
|
15
|
-
* @returns
|
|
13
|
+
* @param contentType - The type of the content to get.
|
|
14
|
+
* Only `plaintext`, 'image' and 'url' are supported.
|
|
15
|
+
* @returns The actual clipboard content encoded into base64 string.
|
|
16
16
|
* An empty string is returned if the clipboard contains no data.
|
|
17
|
-
* @this {XCUITestDriver}
|
|
18
17
|
*/
|
|
19
|
-
export function getClipboard(this:
|
|
20
|
-
export type XCUITestDriver = import("../driver").XCUITestDriver;
|
|
18
|
+
export declare function getClipboard(this: XCUITestDriver, contentType?: string): Promise<string>;
|
|
21
19
|
//# sourceMappingURL=clipboard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clipboard.d.ts","sourceRoot":"","sources":["../../../lib/commands/clipboard.
|
|
1
|
+
{"version":3,"file":"clipboard.d.ts","sourceRoot":"","sources":["../../../lib/commands/clipboard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,WAAW,CAAC;AAE9C;;;;;;GAMG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,cAAc,EACpB,OAAO,EAAE,MAAM,EACf,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,IAAI,CAAC,CAKf;AAED;;;;;;;GAOG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,cAAc,EACpB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,MAAM,CAAC,CAIjB"}
|
|
@@ -5,10 +5,9 @@ exports.getClipboard = getClipboard;
|
|
|
5
5
|
/**
|
|
6
6
|
* Sets the primary clipboard's content on the device under test.
|
|
7
7
|
*
|
|
8
|
-
* @param
|
|
9
|
-
* @param
|
|
10
|
-
*
|
|
11
|
-
* @this {XCUITestDriver}
|
|
8
|
+
* @param content - The content to be set as base64 encoded string.
|
|
9
|
+
* @param contentType - The type of the content to set.
|
|
10
|
+
* Only `plaintext`, 'image' and 'url' are supported.
|
|
12
11
|
*/
|
|
13
12
|
async function setClipboard(content, contentType) {
|
|
14
13
|
await this.proxyCommand('/wda/setPasteboard', 'POST', {
|
|
@@ -19,18 +18,14 @@ async function setClipboard(content, contentType) {
|
|
|
19
18
|
/**
|
|
20
19
|
* Gets the content of the primary clipboard on the device under test.
|
|
21
20
|
*
|
|
22
|
-
* @param
|
|
23
|
-
*
|
|
24
|
-
* @returns
|
|
21
|
+
* @param contentType - The type of the content to get.
|
|
22
|
+
* Only `plaintext`, 'image' and 'url' are supported.
|
|
23
|
+
* @returns The actual clipboard content encoded into base64 string.
|
|
25
24
|
* An empty string is returned if the clipboard contains no data.
|
|
26
|
-
* @this {XCUITestDriver}
|
|
27
25
|
*/
|
|
28
26
|
async function getClipboard(contentType) {
|
|
29
|
-
return
|
|
27
|
+
return await this.proxyCommand('/wda/getPasteboard', 'POST', {
|
|
30
28
|
contentType,
|
|
31
|
-
})
|
|
29
|
+
});
|
|
32
30
|
}
|
|
33
|
-
/**
|
|
34
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
35
|
-
*/
|
|
36
31
|
//# sourceMappingURL=clipboard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clipboard.js","sourceRoot":"","sources":["../../../lib/commands/clipboard.
|
|
1
|
+
{"version":3,"file":"clipboard.js","sourceRoot":"","sources":["../../../lib/commands/clipboard.ts"],"names":[],"mappings":";;AASA,oCASC;AAUD,oCAOC;AAjCD;;;;;;GAMG;AACI,KAAK,UAAU,YAAY,CAEhC,OAAe,EACf,WAAoB;IAEpB,MAAM,IAAI,CAAC,YAAY,CAAC,oBAAoB,EAAE,MAAM,EAAE;QACpD,OAAO;QACP,WAAW;KACZ,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;GAOG;AACI,KAAK,UAAU,YAAY,CAEhC,WAAoB;IAEpB,OAAO,MAAM,IAAI,CAAC,YAAY,CAAc,oBAAoB,EAAE,MAAM,EAAE;QACxE,WAAW;KACZ,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,24 +1,21 @@
|
|
|
1
|
+
import type { XCUITestDriver } from '../driver';
|
|
2
|
+
import type { IncreaseContrastAction, IncreaseContrastResult } from './types';
|
|
1
3
|
/**
|
|
2
4
|
* Sets the increase contrast configuration for the given simulator.
|
|
3
5
|
*
|
|
4
6
|
* @since Xcode 15 (but lower xcode could have this command)
|
|
5
|
-
* @param
|
|
6
|
-
*
|
|
7
|
-
* @throws
|
|
8
|
-
* @this {XCUITestDriver}
|
|
7
|
+
* @param increaseContrast - Valid increase contrast configuration value.
|
|
8
|
+
* Acceptable value is 'enabled' or 'disabled' with Xcode 16.2.
|
|
9
|
+
* @throws If the current platform does not support content size appearance changes
|
|
9
10
|
*/
|
|
10
|
-
export function mobileSetIncreaseContrast(this:
|
|
11
|
+
export declare function mobileSetIncreaseContrast(this: XCUITestDriver, increaseContrast: IncreaseContrastAction): Promise<void>;
|
|
11
12
|
/**
|
|
12
13
|
* Retrieves the current increase contrast configuration value from the given simulator.
|
|
13
14
|
*
|
|
14
15
|
* @since Xcode 15 (but lower xcode could have this command)
|
|
15
|
-
* @returns
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* @this {XCUITestDriver}
|
|
16
|
+
* @returns The contrast configuration value.
|
|
17
|
+
* Possible return value is 'enabled', 'disabled',
|
|
18
|
+
* 'unsupported' or 'unknown' with Xcode 16.2.
|
|
19
19
|
*/
|
|
20
|
-
export function mobileGetIncreaseContrast(this:
|
|
21
|
-
export type XCUITestDriver = import("../driver").XCUITestDriver;
|
|
22
|
-
export type IncreaseContrastAction = import("./types").IncreaseContrastAction;
|
|
23
|
-
export type IncreaseContrastResult = import("./types").IncreaseContrastResult;
|
|
20
|
+
export declare function mobileGetIncreaseContrast(this: XCUITestDriver): Promise<IncreaseContrastResult>;
|
|
24
21
|
//# sourceMappingURL=increase-contrast.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"increase-contrast.d.ts","sourceRoot":"","sources":["../../../lib/commands/increase-contrast.
|
|
1
|
+
{"version":3,"file":"increase-contrast.d.ts","sourceRoot":"","sources":["../../../lib/commands/increase-contrast.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAC,sBAAsB,EAAE,sBAAsB,EAAC,MAAM,SAAS,CAAC;AAU5E;;;;;;;GAOG;AACH,wBAAsB,yBAAyB,CAC7C,IAAI,EAAE,cAAc,EACpB,gBAAgB,EAAE,sBAAsB,GACvC,OAAO,CAAC,IAAI,CAAC,CAQf;AAED;;;;;;;GAOG;AACH,wBAAsB,yBAAyB,CAC7C,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,sBAAsB,CAAC,CAEjC"}
|
|
@@ -17,33 +17,25 @@ const INCREASE_CONTRAST_CONFIG = [
|
|
|
17
17
|
* Sets the increase contrast configuration for the given simulator.
|
|
18
18
|
*
|
|
19
19
|
* @since Xcode 15 (but lower xcode could have this command)
|
|
20
|
-
* @param
|
|
21
|
-
*
|
|
22
|
-
* @throws
|
|
23
|
-
* @this {XCUITestDriver}
|
|
20
|
+
* @param increaseContrast - Valid increase contrast configuration value.
|
|
21
|
+
* Acceptable value is 'enabled' or 'disabled' with Xcode 16.2.
|
|
22
|
+
* @throws If the current platform does not support content size appearance changes
|
|
24
23
|
*/
|
|
25
24
|
async function mobileSetIncreaseContrast(increaseContrast) {
|
|
26
|
-
const simulator = assertSimulator(this);
|
|
27
25
|
if (!INCREASE_CONTRAST_CONFIG.includes(lodash_1.default.lowerCase(increaseContrast))) {
|
|
28
26
|
throw new driver_1.errors.InvalidArgumentError(`The 'increaseContrast' value is expected to be one of ${INCREASE_CONTRAST_CONFIG.join(',')}`);
|
|
29
27
|
}
|
|
30
|
-
await
|
|
28
|
+
await assertSimulator(this).setIncreaseContrast(increaseContrast);
|
|
31
29
|
}
|
|
32
30
|
/**
|
|
33
31
|
* Retrieves the current increase contrast configuration value from the given simulator.
|
|
34
32
|
*
|
|
35
33
|
* @since Xcode 15 (but lower xcode could have this command)
|
|
36
|
-
* @returns
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* @this {XCUITestDriver}
|
|
34
|
+
* @returns The contrast configuration value.
|
|
35
|
+
* Possible return value is 'enabled', 'disabled',
|
|
36
|
+
* 'unsupported' or 'unknown' with Xcode 16.2.
|
|
40
37
|
*/
|
|
41
38
|
async function mobileGetIncreaseContrast() {
|
|
42
|
-
return
|
|
39
|
+
return await assertSimulator(this).getIncreaseContrast();
|
|
43
40
|
}
|
|
44
|
-
/**
|
|
45
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
46
|
-
* @typedef {import('./types').IncreaseContrastAction} IncreaseContrastAction
|
|
47
|
-
* @typedef {import('./types').IncreaseContrastResult} IncreaseContrastResult
|
|
48
|
-
*/
|
|
49
41
|
//# sourceMappingURL=increase-contrast.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"increase-contrast.js","sourceRoot":"","sources":["../../../lib/commands/increase-contrast.
|
|
1
|
+
{"version":3,"file":"increase-contrast.js","sourceRoot":"","sources":["../../../lib/commands/increase-contrast.ts"],"names":[],"mappings":";;;;;AAsBA,8DAWC;AAUD,8DAIC;AA/CD,oDAAuB;AACvB,oCAA6D;AAC7D,0CAAuC;AAKvC,MAAM,eAAe,GAAG,CAAC,MAAsB,EAAa,EAAE,CAAC,uBAAgB,CAAC,IAAI,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC;AAExH,MAAM,wBAAwB,GAAG;IAC7B,SAAS;IACT,UAAU;CACJ,CAAC;AAEX;;;;;;;GAOG;AACI,KAAK,UAAU,yBAAyB,CAE7C,gBAAwC;IAExC,IAAI,CAAE,wBAA8C,CAAC,QAAQ,CAAC,gBAAC,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC;QAC7F,MAAM,IAAI,eAAM,CAAC,oBAAoB,CACnC,yDAAyD,wBAAwB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAC9F,CAAC;IACJ,CAAC;IAED,MAAM,eAAe,CAAC,IAAI,CAAC,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;AACpE,CAAC;AAED;;;;;;;GAOG;AACI,KAAK,UAAU,yBAAyB;IAG7C,OAAO,MAAM,eAAe,CAAC,IAAI,CAAC,CAAC,mBAAmB,EAA4B,CAAC;AACrF,CAAC"}
|
|
@@ -1,23 +1,19 @@
|
|
|
1
|
+
import type { XCUITestDriver } from '../driver';
|
|
1
2
|
/**
|
|
2
3
|
* Lock the device (and optionally unlock the device after a certain amount of time)
|
|
3
4
|
*
|
|
4
|
-
* @param
|
|
5
|
+
* @param seconds - The number of seconds after which to unlock the device. Set to `0` or leave empty to require manual unlock (do not automatically unlock).
|
|
5
6
|
* @defaultValue 0
|
|
6
|
-
* @this {XCUITestDriver}
|
|
7
7
|
*/
|
|
8
|
-
export function lock(this:
|
|
8
|
+
export declare function lock(this: XCUITestDriver, seconds?: number | string): Promise<void>;
|
|
9
9
|
/**
|
|
10
10
|
* Unlock the device
|
|
11
|
-
*
|
|
12
|
-
* @this {XCUITestDriver}
|
|
13
11
|
*/
|
|
14
|
-
export function unlock(this:
|
|
12
|
+
export declare function unlock(this: XCUITestDriver): Promise<void>;
|
|
15
13
|
/**
|
|
16
14
|
* Determine whether the device is locked
|
|
17
15
|
*
|
|
18
|
-
* @
|
|
19
|
-
* @returns {Promise<boolean>} `true` if the device is locked, `false` otherwise
|
|
16
|
+
* @returns `true` if the device is locked, `false` otherwise
|
|
20
17
|
*/
|
|
21
|
-
export function isLocked(this:
|
|
22
|
-
export type XCUITestDriver = import("../driver").XCUITestDriver;
|
|
18
|
+
export declare function isLocked(this: XCUITestDriver): Promise<boolean>;
|
|
23
19
|
//# sourceMappingURL=lock.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lock.d.ts","sourceRoot":"","sources":["../../../lib/commands/lock.
|
|
1
|
+
{"version":3,"file":"lock.d.ts","sourceRoot":"","sources":["../../../lib/commands/lock.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,WAAW,CAAC;AAE9C;;;;;GAKG;AACH,wBAAsB,IAAI,CACxB,IAAI,EAAE,cAAc,EACpB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GACxB,OAAO,CAAC,IAAI,CAAC,CAaf;AAED;;GAEG;AACH,wBAAsB,MAAM,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAEhE;AAED;;;;GAIG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,CAErE"}
|
|
@@ -10,9 +10,8 @@ const bluebird_1 = __importDefault(require("bluebird"));
|
|
|
10
10
|
/**
|
|
11
11
|
* Lock the device (and optionally unlock the device after a certain amount of time)
|
|
12
12
|
*
|
|
13
|
-
* @param
|
|
13
|
+
* @param seconds - The number of seconds after which to unlock the device. Set to `0` or leave empty to require manual unlock (do not automatically unlock).
|
|
14
14
|
* @defaultValue 0
|
|
15
|
-
* @this {XCUITestDriver}
|
|
16
15
|
*/
|
|
17
16
|
async function lock(seconds) {
|
|
18
17
|
await this.proxyCommand('/wda/lock', 'POST');
|
|
@@ -28,8 +27,6 @@ async function lock(seconds) {
|
|
|
28
27
|
}
|
|
29
28
|
/**
|
|
30
29
|
* Unlock the device
|
|
31
|
-
*
|
|
32
|
-
* @this {XCUITestDriver}
|
|
33
30
|
*/
|
|
34
31
|
async function unlock() {
|
|
35
32
|
await this.proxyCommand('/wda/unlock', 'POST');
|
|
@@ -37,13 +34,9 @@ async function unlock() {
|
|
|
37
34
|
/**
|
|
38
35
|
* Determine whether the device is locked
|
|
39
36
|
*
|
|
40
|
-
* @
|
|
41
|
-
* @returns {Promise<boolean>} `true` if the device is locked, `false` otherwise
|
|
37
|
+
* @returns `true` if the device is locked, `false` otherwise
|
|
42
38
|
*/
|
|
43
39
|
async function isLocked() {
|
|
44
|
-
return
|
|
40
|
+
return await this.proxyCommand('/wda/locked', 'GET');
|
|
45
41
|
}
|
|
46
|
-
/**
|
|
47
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
48
|
-
*/
|
|
49
42
|
//# sourceMappingURL=lock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lock.js","sourceRoot":"","sources":["../../../lib/commands/lock.
|
|
1
|
+
{"version":3,"file":"lock.js","sourceRoot":"","sources":["../../../lib/commands/lock.ts"],"names":[],"mappings":";;;;;AASA,oBAgBC;AAKD,wBAEC;AAOD,4BAEC;AAzCD,wDAAyB;AAGzB;;;;;GAKG;AACI,KAAK,UAAU,IAAI,CAExB,OAAyB;IAEzB,MAAM,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IAC7C,IAAI,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC;QAC3B,OAAO;IACT,CAAC;IAED,MAAM,YAAY,GAAG,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IACjD,IAAI,YAAY,IAAI,CAAC,EAAE,CAAC;QACtB,OAAO;IACT,CAAC;IAED,MAAM,kBAAC,CAAC,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IACnC,MAAM,IAAI,CAAC,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;AACjD,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,MAAM;IAC1B,MAAM,IAAI,CAAC,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;AACjD,CAAC;AAED;;;;GAIG;AACI,KAAK,UAAU,QAAQ;IAC5B,OAAO,MAAM,IAAI,CAAC,YAAY,CAAe,aAAa,EAAE,KAAK,CAAC,CAAC;AACrE,CAAC"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
+
import type { XCUITestDriver } from '../driver';
|
|
1
2
|
/**
|
|
2
3
|
* Simulates Low Memory warning on the given application
|
|
3
4
|
*
|
|
4
5
|
* @since Xcode 15
|
|
5
|
-
* @param
|
|
6
|
-
* @
|
|
7
|
-
* @throws {Error} if the app is not running or is not installed
|
|
6
|
+
* @param bundleId - The bundle identifier of the target app. The app must be running
|
|
7
|
+
* @throws If the app is not running or is not installed
|
|
8
8
|
*/
|
|
9
|
-
export function mobileSendMemoryWarning(this:
|
|
10
|
-
export type XCUITestDriver = import("../driver").XCUITestDriver;
|
|
9
|
+
export declare function mobileSendMemoryWarning(this: XCUITestDriver, bundleId: string): Promise<void>;
|
|
11
10
|
//# sourceMappingURL=memory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../../lib/commands/memory.
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../../lib/commands/memory.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,WAAW,CAAC;AAG9C;;;;;;GAMG;AACH,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,cAAc,EACpB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC,CAkCf"}
|
|
@@ -10,15 +10,14 @@ const driver_1 = require("appium/driver");
|
|
|
10
10
|
* Simulates Low Memory warning on the given application
|
|
11
11
|
*
|
|
12
12
|
* @since Xcode 15
|
|
13
|
-
* @param
|
|
14
|
-
* @
|
|
15
|
-
* @throws {Error} if the app is not running or is not installed
|
|
13
|
+
* @param bundleId - The bundle identifier of the target app. The app must be running
|
|
14
|
+
* @throws If the app is not running or is not installed
|
|
16
15
|
*/
|
|
17
16
|
async function mobileSendMemoryWarning(bundleId) {
|
|
18
17
|
if (!this.isRealDevice()) {
|
|
19
18
|
throw new Error('Memory warning simulation is only supported on real devices');
|
|
20
19
|
}
|
|
21
|
-
const device =
|
|
20
|
+
const device = this.device;
|
|
22
21
|
const appInfos = await device.devicectl.listApps(bundleId);
|
|
23
22
|
if (lodash_1.default.isEmpty(appInfos)) {
|
|
24
23
|
throw new driver_1.errors.InvalidArgumentError(`The application identified by ${bundleId} cannot be found on the device. Is it installed?`);
|
|
@@ -33,7 +32,6 @@ async function mobileSendMemoryWarning(bundleId) {
|
|
|
33
32
|
// Unfortunately devicectl does not provide more info which would
|
|
34
33
|
// allow to connect a bundle id to a process id.
|
|
35
34
|
const pattern = new RegExp(`^${lodash_1.default.escapeRegExp(appInfos[0].url)}[^/]+$`);
|
|
36
|
-
/** @type {number[]} */
|
|
37
35
|
const pids = (await device.devicectl.listProcesses())
|
|
38
36
|
.filter(({ executable }) => pattern.test(executable))
|
|
39
37
|
.map(({ processIdentifier }) => processIdentifier);
|
|
@@ -43,7 +41,4 @@ async function mobileSendMemoryWarning(bundleId) {
|
|
|
43
41
|
this.log.info(`Emulating Low Memory warning for the process id ${pids[0]}, bundle id ${bundleId}`);
|
|
44
42
|
await device.devicectl.sendMemoryWarning(pids[0]);
|
|
45
43
|
}
|
|
46
|
-
/**
|
|
47
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
48
|
-
*/
|
|
49
44
|
//# sourceMappingURL=memory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.js","sourceRoot":"","sources":["../../../lib/commands/memory.
|
|
1
|
+
{"version":3,"file":"memory.js","sourceRoot":"","sources":["../../../lib/commands/memory.ts"],"names":[],"mappings":";;;;;AAYA,0DAqCC;AAjDD,oDAAuB;AACvB,0CAAuC;AAIvC;;;;;;GAMG;AACI,KAAK,UAAU,uBAAuB,CAE3C,QAAgB;IAEhB,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;IACjF,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,CAAC,MAAoB,CAAC;IAEzC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC3D,IAAI,gBAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,eAAM,CAAC,oBAAoB,CACnC,iCAAiC,QAAQ,kDAAkD,CAC5F,CAAC;IACJ,CAAC;IAED,6EAA6E;IAC7E,gDAAgD;IAChD,uGAAuG;IACvG,gDAAgD;IAChD,6GAA6G;IAC7G,oJAAoJ;IACpJ,4CAA4C;IAC5C,iEAAiE;IACjE,gDAAgD;IAChD,MAAM,OAAO,GAAG,IAAI,MAAM,CAAC,IAAI,gBAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACxE,MAAM,IAAI,GAAG,CAAC,MAAM,MAAM,CAAC,SAAS,CAAC,aAAa,EAAE,CAAC;SAClD,MAAM,CAAC,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SAClD,GAAG,CAAC,CAAC,EAAC,iBAAiB,EAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,CAAC;IACnD,IAAI,gBAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACpB,MAAM,IAAI,eAAM,CAAC,oBAAoB,CACnC,iCAAiC,QAAQ,8DAA8D,CACxG,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,mDAAmD,IAAI,CAAC,CAAC,CAAC,eAAe,QAAQ,EAAE,CAAC,CAAC;IACnG,MAAM,MAAM,CAAC,SAAS,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -1,23 +1,22 @@
|
|
|
1
|
+
import type { XCUITestDriver } from '../driver';
|
|
1
2
|
/**
|
|
2
3
|
* Sets the Simulator's pasteboard content to the given value.
|
|
3
4
|
*
|
|
4
5
|
* Does not work for real devices.
|
|
5
|
-
*
|
|
6
|
-
* @param
|
|
6
|
+
*
|
|
7
|
+
* @param content - The content to set
|
|
8
|
+
* @param encoding - The content's encoding
|
|
7
9
|
* @group Simulator Only
|
|
8
|
-
* @returns {Promise<void>}
|
|
9
|
-
* @this {XCUITestDriver}
|
|
10
10
|
*/
|
|
11
|
-
export function mobileSetPasteboard(this:
|
|
11
|
+
export declare function mobileSetPasteboard(this: XCUITestDriver, content: string, encoding?: BufferEncoding): Promise<void>;
|
|
12
12
|
/**
|
|
13
13
|
* Gets the Simulator's pasteboard content.
|
|
14
14
|
*
|
|
15
15
|
* Does not work for real devices.
|
|
16
|
-
*
|
|
16
|
+
*
|
|
17
|
+
* @param encoding - Expected encoding of returned string
|
|
17
18
|
* @group Simulator Only
|
|
18
|
-
* @
|
|
19
|
-
* @returns {Promise<string>} The pasteboard content string
|
|
19
|
+
* @returns The pasteboard content string
|
|
20
20
|
*/
|
|
21
|
-
export function mobileGetPasteboard(this:
|
|
22
|
-
export type XCUITestDriver = import("../driver").XCUITestDriver;
|
|
21
|
+
export declare function mobileGetPasteboard(this: XCUITestDriver, encoding?: BufferEncoding): Promise<string>;
|
|
23
22
|
//# sourceMappingURL=pasteboard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pasteboard.d.ts","sourceRoot":"","sources":["../../../lib/commands/pasteboard.
|
|
1
|
+
{"version":3,"file":"pasteboard.d.ts","sourceRoot":"","sources":["../../../lib/commands/pasteboard.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,WAAW,CAAC;AAG9C;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,cAAc,EACpB,OAAO,EAAE,MAAM,EACf,QAAQ,GAAE,cAAuB,GAChC,OAAO,CAAC,IAAI,CAAC,CAOf;AAED;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,cAAc,EACpB,QAAQ,GAAE,cAAuB,GAChC,OAAO,CAAC,MAAM,CAAC,CAGjB"}
|
|
@@ -11,11 +11,10 @@ const utils_1 = require("../utils");
|
|
|
11
11
|
* Sets the Simulator's pasteboard content to the given value.
|
|
12
12
|
*
|
|
13
13
|
* Does not work for real devices.
|
|
14
|
-
*
|
|
15
|
-
* @param
|
|
14
|
+
*
|
|
15
|
+
* @param content - The content to set
|
|
16
|
+
* @param encoding - The content's encoding
|
|
16
17
|
* @group Simulator Only
|
|
17
|
-
* @returns {Promise<void>}
|
|
18
|
-
* @this {XCUITestDriver}
|
|
19
18
|
*/
|
|
20
19
|
async function mobileSetPasteboard(content, encoding = 'utf8') {
|
|
21
20
|
utils_1.assertSimulator.call(this, 'Setting pasteboard content');
|
|
@@ -23,23 +22,19 @@ async function mobileSetPasteboard(content, encoding = 'utf8') {
|
|
|
23
22
|
// can be empty string
|
|
24
23
|
throw new Error('Pasteboard content is mandatory to set');
|
|
25
24
|
}
|
|
26
|
-
|
|
25
|
+
await this.device.simctl.setPasteboard(content, encoding);
|
|
27
26
|
}
|
|
28
27
|
/**
|
|
29
28
|
* Gets the Simulator's pasteboard content.
|
|
30
29
|
*
|
|
31
30
|
* Does not work for real devices.
|
|
32
|
-
*
|
|
31
|
+
*
|
|
32
|
+
* @param encoding - Expected encoding of returned string
|
|
33
33
|
* @group Simulator Only
|
|
34
|
-
* @
|
|
35
|
-
* @returns {Promise<string>} The pasteboard content string
|
|
34
|
+
* @returns The pasteboard content string
|
|
36
35
|
*/
|
|
37
36
|
async function mobileGetPasteboard(encoding = 'utf8') {
|
|
38
37
|
utils_1.assertSimulator.call(this, 'Getting pasteboard content');
|
|
39
|
-
return await
|
|
40
|
-
/** @type {BufferEncoding} */ (encoding));
|
|
38
|
+
return await this.device.simctl.getPasteboard(encoding);
|
|
41
39
|
}
|
|
42
|
-
/**
|
|
43
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
44
|
-
*/
|
|
45
40
|
//# sourceMappingURL=pasteboard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pasteboard.js","sourceRoot":"","sources":["../../../lib/commands/pasteboard.
|
|
1
|
+
{"version":3,"file":"pasteboard.js","sourceRoot":"","sources":["../../../lib/commands/pasteboard.ts"],"names":[],"mappings":";;;;;AAcA,kDAWC;AAWD,kDAMC;AA1CD,oDAAuB;AACvB,oCAA2C;AAI3C;;;;;;;;GAQG;AACI,KAAK,UAAU,mBAAmB,CAEvC,OAAe,EACf,WAA2B,MAAM;IAEjC,uBAAe,CAAC,IAAI,CAAC,IAAI,EAAE,4BAA4B,CAAC,CAAC;IACzD,IAAI,CAAC,gBAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QACzB,sBAAsB;QACtB,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAC5D,CAAC;IACD,MAAO,IAAI,CAAC,MAAoB,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC3E,CAAC;AAED;;;;;;;;GAQG;AACI,KAAK,UAAU,mBAAmB,CAEvC,WAA2B,MAAM;IAEjC,uBAAe,CAAC,IAAI,CAAC,IAAI,EAAE,4BAA4B,CAAC,CAAC;IACzD,OAAO,MAAO,IAAI,CAAC,MAAoB,CAAC,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;AACzE,CAAC"}
|
|
@@ -1,26 +1,29 @@
|
|
|
1
1
|
import { isIos18OrNewer } from '../utils';
|
|
2
|
+
import type {XCUITestDriver} from '../driver';
|
|
3
|
+
import type {BatteryInfo} from './types';
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
6
|
* Reads the battery information from the device under test.
|
|
5
7
|
*
|
|
6
8
|
* This endpoint only returns reliable result on real devices.
|
|
7
9
|
*
|
|
8
|
-
* @returns
|
|
9
|
-
* @this {import('../driver').XCUITestDriver}
|
|
10
|
+
* @returns Battery information with advanced details
|
|
10
11
|
*/
|
|
11
|
-
export async function mobileGetBatteryInfo(
|
|
12
|
-
|
|
12
|
+
export async function mobileGetBatteryInfo(
|
|
13
|
+
this: XCUITestDriver,
|
|
14
|
+
): Promise<BatteryInfo & {advanced: Record<string, any>}> {
|
|
15
|
+
let batteryInfoFromShimService: Record<string, any> | undefined;
|
|
13
16
|
if (isIos18OrNewer(this.opts) && this.isRealDevice()) {
|
|
14
17
|
let remoteXPCConnection;
|
|
15
18
|
try {
|
|
16
19
|
const {Services} = await import('appium-ios-remotexpc');
|
|
17
|
-
|
|
20
|
+
const { diagnosticsService, remoteXPC } = await Services.startDiagnosticsService(this.device.udid);
|
|
18
21
|
remoteXPCConnection = remoteXPC;
|
|
19
22
|
batteryInfoFromShimService = await diagnosticsService.ioregistry({
|
|
20
23
|
ioClass: 'IOPMPowerSource',
|
|
21
24
|
returnRawJson: true,
|
|
22
25
|
});
|
|
23
|
-
} catch (err) {
|
|
26
|
+
} catch (err: any) {
|
|
24
27
|
this.log.error(`Failed to get battery info from DiagnosticsService: ${err.message}`);
|
|
25
28
|
} finally {
|
|
26
29
|
if (remoteXPCConnection) {
|
|
@@ -30,15 +33,10 @@ export async function mobileGetBatteryInfo() {
|
|
|
30
33
|
}
|
|
31
34
|
}
|
|
32
35
|
|
|
33
|
-
const batteryInfoFromWda =
|
|
34
|
-
await this.proxyCommand('/wda/batteryInfo', 'GET')
|
|
35
|
-
);
|
|
36
|
+
const batteryInfoFromWda = await this.proxyCommand<any, BatteryInfo>('/wda/batteryInfo', 'GET');
|
|
36
37
|
return {
|
|
37
38
|
...batteryInfoFromWda,
|
|
38
39
|
advanced: batteryInfoFromShimService || {},
|
|
39
40
|
};
|
|
40
41
|
}
|
|
41
42
|
|
|
42
|
-
/**
|
|
43
|
-
* @typedef {import('./types').BatteryInfo} BatteryInfo
|
|
44
|
-
*/
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type {XCUITestDriver} from '../driver';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Sets the primary clipboard's content on the device under test.
|
|
5
|
+
*
|
|
6
|
+
* @param content - The content to be set as base64 encoded string.
|
|
7
|
+
* @param contentType - The type of the content to set.
|
|
8
|
+
* Only `plaintext`, 'image' and 'url' are supported.
|
|
9
|
+
*/
|
|
10
|
+
export async function setClipboard(
|
|
11
|
+
this: XCUITestDriver,
|
|
12
|
+
content: string,
|
|
13
|
+
contentType?: string,
|
|
14
|
+
): Promise<void> {
|
|
15
|
+
await this.proxyCommand('/wda/setPasteboard', 'POST', {
|
|
16
|
+
content,
|
|
17
|
+
contentType,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Gets the content of the primary clipboard on the device under test.
|
|
23
|
+
*
|
|
24
|
+
* @param contentType - The type of the content to get.
|
|
25
|
+
* Only `plaintext`, 'image' and 'url' are supported.
|
|
26
|
+
* @returns The actual clipboard content encoded into base64 string.
|
|
27
|
+
* An empty string is returned if the clipboard contains no data.
|
|
28
|
+
*/
|
|
29
|
+
export async function getClipboard(
|
|
30
|
+
this: XCUITestDriver,
|
|
31
|
+
contentType?: string,
|
|
32
|
+
): Promise<string> {
|
|
33
|
+
return await this.proxyCommand<any, string>('/wda/getPasteboard', 'POST', {
|
|
34
|
+
contentType,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
import {assertSimulator as _assertSimulator} from '../utils';
|
|
3
|
+
import { errors } from 'appium/driver';
|
|
4
|
+
import type {XCUITestDriver} from '../driver';
|
|
5
|
+
import type {IncreaseContrastAction, IncreaseContrastResult} from './types';
|
|
6
|
+
import type {Simulator} from 'appium-ios-simulator';
|
|
7
|
+
|
|
8
|
+
const assertSimulator = (driver: XCUITestDriver): Simulator => _assertSimulator.call(driver, 'Content size ui command');
|
|
9
|
+
|
|
10
|
+
const INCREASE_CONTRAST_CONFIG = [
|
|
11
|
+
'enabled',
|
|
12
|
+
'disabled',
|
|
13
|
+
] as const;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Sets the increase contrast configuration for the given simulator.
|
|
17
|
+
*
|
|
18
|
+
* @since Xcode 15 (but lower xcode could have this command)
|
|
19
|
+
* @param increaseContrast - Valid increase contrast configuration value.
|
|
20
|
+
* Acceptable value is 'enabled' or 'disabled' with Xcode 16.2.
|
|
21
|
+
* @throws If the current platform does not support content size appearance changes
|
|
22
|
+
*/
|
|
23
|
+
export async function mobileSetIncreaseContrast(
|
|
24
|
+
this: XCUITestDriver,
|
|
25
|
+
increaseContrast: IncreaseContrastAction,
|
|
26
|
+
): Promise<void> {
|
|
27
|
+
if (!(INCREASE_CONTRAST_CONFIG as readonly string[]).includes(_.lowerCase(increaseContrast))) {
|
|
28
|
+
throw new errors.InvalidArgumentError(
|
|
29
|
+
`The 'increaseContrast' value is expected to be one of ${INCREASE_CONTRAST_CONFIG.join(',')}`
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
await assertSimulator(this).setIncreaseContrast(increaseContrast);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Retrieves the current increase contrast configuration value from the given simulator.
|
|
38
|
+
*
|
|
39
|
+
* @since Xcode 15 (but lower xcode could have this command)
|
|
40
|
+
* @returns The contrast configuration value.
|
|
41
|
+
* Possible return value is 'enabled', 'disabled',
|
|
42
|
+
* 'unsupported' or 'unknown' with Xcode 16.2.
|
|
43
|
+
*/
|
|
44
|
+
export async function mobileGetIncreaseContrast(
|
|
45
|
+
this: XCUITestDriver,
|
|
46
|
+
): Promise<IncreaseContrastResult> {
|
|
47
|
+
return await assertSimulator(this).getIncreaseContrast() as IncreaseContrastResult;
|
|
48
|
+
}
|
|
49
|
+
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import B from 'bluebird';
|
|
2
|
+
import type {XCUITestDriver} from '../driver';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Lock the device (and optionally unlock the device after a certain amount of time)
|
|
6
|
+
*
|
|
7
|
+
* @param seconds - The number of seconds after which to unlock the device. Set to `0` or leave empty to require manual unlock (do not automatically unlock).
|
|
8
|
+
* @defaultValue 0
|
|
9
|
+
*/
|
|
10
|
+
export async function lock(
|
|
11
|
+
this: XCUITestDriver,
|
|
12
|
+
seconds?: number | string,
|
|
13
|
+
): Promise<void> {
|
|
14
|
+
await this.proxyCommand('/wda/lock', 'POST');
|
|
15
|
+
if (isNaN(Number(seconds))) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const floatSeconds = parseFloat(String(seconds));
|
|
20
|
+
if (floatSeconds <= 0) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
await B.delay(floatSeconds * 1000);
|
|
25
|
+
await this.proxyCommand('/wda/unlock', 'POST');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Unlock the device
|
|
30
|
+
*/
|
|
31
|
+
export async function unlock(this: XCUITestDriver): Promise<void> {
|
|
32
|
+
await this.proxyCommand('/wda/unlock', 'POST');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Determine whether the device is locked
|
|
37
|
+
*
|
|
38
|
+
* @returns `true` if the device is locked, `false` otherwise
|
|
39
|
+
*/
|
|
40
|
+
export async function isLocked(this: XCUITestDriver): Promise<boolean> {
|
|
41
|
+
return await this.proxyCommand<any, boolean>('/wda/locked', 'GET');
|
|
42
|
+
}
|
|
43
|
+
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
2
|
import { errors } from 'appium/driver';
|
|
3
|
+
import type {XCUITestDriver} from '../driver';
|
|
4
|
+
import type {RealDevice} from '../device/real-device-management';
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* Simulates Low Memory warning on the given application
|
|
6
8
|
*
|
|
7
9
|
* @since Xcode 15
|
|
8
|
-
* @param
|
|
9
|
-
* @
|
|
10
|
-
* @throws {Error} if the app is not running or is not installed
|
|
10
|
+
* @param bundleId - The bundle identifier of the target app. The app must be running
|
|
11
|
+
* @throws If the app is not running or is not installed
|
|
11
12
|
*/
|
|
12
|
-
export async function mobileSendMemoryWarning(
|
|
13
|
+
export async function mobileSendMemoryWarning(
|
|
14
|
+
this: XCUITestDriver,
|
|
15
|
+
bundleId: string,
|
|
16
|
+
): Promise<void> {
|
|
13
17
|
if (!this.isRealDevice()) {
|
|
14
18
|
throw new Error('Memory warning simulation is only supported on real devices');
|
|
15
19
|
}
|
|
16
20
|
|
|
17
|
-
const device =
|
|
21
|
+
const device = this.device as RealDevice;
|
|
18
22
|
|
|
19
23
|
const appInfos = await device.devicectl.listApps(bundleId);
|
|
20
24
|
if (_.isEmpty(appInfos)) {
|
|
@@ -33,7 +37,6 @@ export async function mobileSendMemoryWarning(bundleId) {
|
|
|
33
37
|
// Unfortunately devicectl does not provide more info which would
|
|
34
38
|
// allow to connect a bundle id to a process id.
|
|
35
39
|
const pattern = new RegExp(`^${_.escapeRegExp(appInfos[0].url)}[^/]+$`);
|
|
36
|
-
/** @type {number[]} */
|
|
37
40
|
const pids = (await device.devicectl.listProcesses())
|
|
38
41
|
.filter(({executable}) => pattern.test(executable))
|
|
39
42
|
.map(({processIdentifier}) => processIdentifier);
|
|
@@ -46,6 +49,3 @@ export async function mobileSendMemoryWarning(bundleId) {
|
|
|
46
49
|
await device.devicectl.sendMemoryWarning(pids[0]);
|
|
47
50
|
}
|
|
48
51
|
|
|
49
|
-
/**
|
|
50
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
51
|
-
*/
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
import { assertSimulator } from '../utils';
|
|
3
|
+
import type {XCUITestDriver} from '../driver';
|
|
4
|
+
import type {Simulator} from 'appium-ios-simulator';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Sets the Simulator's pasteboard content to the given value.
|
|
8
|
+
*
|
|
9
|
+
* Does not work for real devices.
|
|
10
|
+
*
|
|
11
|
+
* @param content - The content to set
|
|
12
|
+
* @param encoding - The content's encoding
|
|
13
|
+
* @group Simulator Only
|
|
14
|
+
*/
|
|
15
|
+
export async function mobileSetPasteboard(
|
|
16
|
+
this: XCUITestDriver,
|
|
17
|
+
content: string,
|
|
18
|
+
encoding: BufferEncoding = 'utf8',
|
|
19
|
+
): Promise<void> {
|
|
20
|
+
assertSimulator.call(this, 'Setting pasteboard content');
|
|
21
|
+
if (!_.isString(content)) {
|
|
22
|
+
// can be empty string
|
|
23
|
+
throw new Error('Pasteboard content is mandatory to set');
|
|
24
|
+
}
|
|
25
|
+
await (this.device as Simulator).simctl.setPasteboard(content, encoding);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Gets the Simulator's pasteboard content.
|
|
30
|
+
*
|
|
31
|
+
* Does not work for real devices.
|
|
32
|
+
*
|
|
33
|
+
* @param encoding - Expected encoding of returned string
|
|
34
|
+
* @group Simulator Only
|
|
35
|
+
* @returns The pasteboard content string
|
|
36
|
+
*/
|
|
37
|
+
export async function mobileGetPasteboard(
|
|
38
|
+
this: XCUITestDriver,
|
|
39
|
+
encoding: BufferEncoding = 'utf8',
|
|
40
|
+
): Promise<string> {
|
|
41
|
+
assertSimulator.call(this, 'Getting pasteboard content');
|
|
42
|
+
return await (this.device as Simulator).simctl.getPasteboard(encoding);
|
|
43
|
+
}
|
|
44
|
+
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "appium-xcuitest-driver",
|
|
3
|
-
"version": "10.14.
|
|
3
|
+
"version": "10.14.5",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "appium-xcuitest-driver",
|
|
9
|
-
"version": "10.14.
|
|
9
|
+
"version": "10.14.5",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@appium/strongbox": "^1.0.0-rc.1",
|
|
@@ -692,9 +692,9 @@
|
|
|
692
692
|
}
|
|
693
693
|
},
|
|
694
694
|
"node_modules/appium-ios-remotexpc": {
|
|
695
|
-
"version": "0.24.
|
|
696
|
-
"resolved": "https://registry.npmjs.org/appium-ios-remotexpc/-/appium-ios-remotexpc-0.24.
|
|
697
|
-
"integrity": "sha512-
|
|
695
|
+
"version": "0.24.2",
|
|
696
|
+
"resolved": "https://registry.npmjs.org/appium-ios-remotexpc/-/appium-ios-remotexpc-0.24.2.tgz",
|
|
697
|
+
"integrity": "sha512-bZBVG5eo/TC9PJJIu/kpGy5YprMn9vcVMKCarNM8rTTtNNUgOE80LPJ5e1UxWj2AnIAXyoJochN996mmiaWvnA==",
|
|
698
698
|
"license": "Apache-2.0",
|
|
699
699
|
"optional": true,
|
|
700
700
|
"dependencies": {
|
|
@@ -880,6 +880,27 @@
|
|
|
880
880
|
"node": ">= 12.0.0"
|
|
881
881
|
}
|
|
882
882
|
},
|
|
883
|
+
"node_modules/appium/node_modules/ws": {
|
|
884
|
+
"version": "8.18.3",
|
|
885
|
+
"resolved": "https://registry.npmjs.org/ws/-/ws-8.18.3.tgz",
|
|
886
|
+
"integrity": "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==",
|
|
887
|
+
"license": "MIT",
|
|
888
|
+
"engines": {
|
|
889
|
+
"node": ">=10.0.0"
|
|
890
|
+
},
|
|
891
|
+
"peerDependencies": {
|
|
892
|
+
"bufferutil": "^4.0.1",
|
|
893
|
+
"utf-8-validate": ">=5.0.2"
|
|
894
|
+
},
|
|
895
|
+
"peerDependenciesMeta": {
|
|
896
|
+
"bufferutil": {
|
|
897
|
+
"optional": true
|
|
898
|
+
},
|
|
899
|
+
"utf-8-validate": {
|
|
900
|
+
"optional": true
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
},
|
|
883
904
|
"node_modules/archiver": {
|
|
884
905
|
"version": "7.0.1",
|
|
885
906
|
"resolved": "https://registry.npmjs.org/archiver/-/archiver-7.0.1.tgz",
|
|
@@ -4697,9 +4718,9 @@
|
|
|
4697
4718
|
"license": "ISC"
|
|
4698
4719
|
},
|
|
4699
4720
|
"node_modules/ws": {
|
|
4700
|
-
"version": "8.
|
|
4701
|
-
"resolved": "https://registry.npmjs.org/ws/-/ws-8.
|
|
4702
|
-
"integrity": "sha512-
|
|
4721
|
+
"version": "8.19.0",
|
|
4722
|
+
"resolved": "https://registry.npmjs.org/ws/-/ws-8.19.0.tgz",
|
|
4723
|
+
"integrity": "sha512-blAT2mjOEIi0ZzruJfIhb3nps74PRWTCz1IjglWEEpQl5XS/UNama6u2/rjFkDDouqr4L67ry+1aGIALViWjDg==",
|
|
4703
4724
|
"license": "MIT",
|
|
4704
4725
|
"engines": {
|
|
4705
4726
|
"node": ">=10.0.0"
|
package/package.json
CHANGED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sets the primary clipboard's content on the device under test.
|
|
3
|
-
*
|
|
4
|
-
* @param {string} content - The content to be set as base64 encoded string.
|
|
5
|
-
* @param {string} [contentType=plaintext] - The type of the content to set.
|
|
6
|
-
* Only `plaintext`, 'image and 'url' are supported.
|
|
7
|
-
* @this {XCUITestDriver}
|
|
8
|
-
*/
|
|
9
|
-
export async function setClipboard(content, contentType) {
|
|
10
|
-
await this.proxyCommand('/wda/setPasteboard', 'POST', {
|
|
11
|
-
content,
|
|
12
|
-
contentType,
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Gets the content of the primary clipboard on the device under test.
|
|
18
|
-
*
|
|
19
|
-
* @param {string} [contentType=plaintext] - The type of the content to get.
|
|
20
|
-
* Only `plaintext`, 'image and 'url' are supported.
|
|
21
|
-
* @returns {Promise<string>} The actual clipboard content encoded into base64 string.
|
|
22
|
-
* An empty string is returned if the clipboard contains no data.
|
|
23
|
-
* @this {XCUITestDriver}
|
|
24
|
-
*/
|
|
25
|
-
export async function getClipboard(contentType) {
|
|
26
|
-
return /** @type {string} */ (
|
|
27
|
-
await this.proxyCommand('/wda/getPasteboard', 'POST', {
|
|
28
|
-
contentType,
|
|
29
|
-
})
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
35
|
-
*/
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import _ from 'lodash';
|
|
2
|
-
import {assertSimulator as _assertSimulator} from '../utils';
|
|
3
|
-
import { errors } from 'appium/driver';
|
|
4
|
-
|
|
5
|
-
const assertSimulator = (driver) => _assertSimulator.call(driver, 'Content size ui command');
|
|
6
|
-
|
|
7
|
-
const INCREASE_CONTRAST_CONFIG = [
|
|
8
|
-
'enabled',
|
|
9
|
-
'disabled',
|
|
10
|
-
];
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Sets the increase contrast configuration for the given simulator.
|
|
14
|
-
*
|
|
15
|
-
* @since Xcode 15 (but lower xcode could have this command)
|
|
16
|
-
* @param {IncreaseContrastAction} increaseContrast valid increase contrast configuration value.
|
|
17
|
-
* Acceptable value is 'enabled' or 'disabled' with Xcode 16.2.
|
|
18
|
-
* @throws {Error} if the current platform does not support content size appearance changes
|
|
19
|
-
* @this {XCUITestDriver}
|
|
20
|
-
*/
|
|
21
|
-
export async function mobileSetIncreaseContrast(increaseContrast) {
|
|
22
|
-
const simulator = assertSimulator(this);
|
|
23
|
-
|
|
24
|
-
if (!INCREASE_CONTRAST_CONFIG.includes(_.lowerCase(increaseContrast))) {
|
|
25
|
-
throw new errors.InvalidArgumentError(
|
|
26
|
-
`The 'increaseContrast' value is expected to be one of ${INCREASE_CONTRAST_CONFIG.join(',')}`
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
await simulator.setIncreaseContrast(increaseContrast);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Retrieves the current increase contrast configuration value from the given simulator.
|
|
35
|
-
*
|
|
36
|
-
* @since Xcode 15 (but lower xcode could have this command)
|
|
37
|
-
* @returns {Promise<IncreaseContrastResult>} the contrast configuration value.
|
|
38
|
-
* Possible return value is 'enabled', 'disabled',
|
|
39
|
-
* 'unsupported' or 'unknown' with Xcode 16.2.
|
|
40
|
-
* @this {XCUITestDriver}
|
|
41
|
-
*/
|
|
42
|
-
export async function mobileGetIncreaseContrast() {
|
|
43
|
-
return /** @type {IncreaseContrastResult} */ (await assertSimulator(this).getIncreaseContrast());
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
48
|
-
* @typedef {import('./types').IncreaseContrastAction} IncreaseContrastAction
|
|
49
|
-
* @typedef {import('./types').IncreaseContrastResult} IncreaseContrastResult
|
|
50
|
-
*/
|
package/lib/commands/lock.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import B from 'bluebird';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Lock the device (and optionally unlock the device after a certain amount of time)
|
|
5
|
-
*
|
|
6
|
-
* @param {number|string} [seconds] - the number of seconds after which to unlock the device. Set to `0` or leave empty to require manual unlock (do not automatically unlock).
|
|
7
|
-
* @defaultValue 0
|
|
8
|
-
* @this {XCUITestDriver}
|
|
9
|
-
*/
|
|
10
|
-
export async function lock(seconds) {
|
|
11
|
-
await this.proxyCommand('/wda/lock', 'POST');
|
|
12
|
-
if (isNaN(Number(seconds))) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const floatSeconds = parseFloat(String(seconds));
|
|
17
|
-
if (floatSeconds <= 0) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
await B.delay(floatSeconds * 1000);
|
|
22
|
-
await this.proxyCommand('/wda/unlock', 'POST');
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Unlock the device
|
|
27
|
-
*
|
|
28
|
-
* @this {XCUITestDriver}
|
|
29
|
-
*/
|
|
30
|
-
export async function unlock() {
|
|
31
|
-
await this.proxyCommand('/wda/unlock', 'POST');
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Determine whether the device is locked
|
|
36
|
-
*
|
|
37
|
-
* @this {XCUITestDriver}
|
|
38
|
-
* @returns {Promise<boolean>} `true` if the device is locked, `false` otherwise
|
|
39
|
-
*/
|
|
40
|
-
export async function isLocked() {
|
|
41
|
-
return /** @type {boolean} */ (await this.proxyCommand('/wda/locked', 'GET'));
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
46
|
-
*/
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import _ from 'lodash';
|
|
2
|
-
import { assertSimulator } from '../utils';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Sets the Simulator's pasteboard content to the given value.
|
|
6
|
-
*
|
|
7
|
-
* Does not work for real devices.
|
|
8
|
-
* @param {string} content - The content to set
|
|
9
|
-
* @param {string} encoding - The content's encoding
|
|
10
|
-
* @group Simulator Only
|
|
11
|
-
* @returns {Promise<void>}
|
|
12
|
-
* @this {XCUITestDriver}
|
|
13
|
-
*/
|
|
14
|
-
export async function mobileSetPasteboard(content, encoding = 'utf8') {
|
|
15
|
-
assertSimulator.call(this, 'Setting pasteboard content');
|
|
16
|
-
if (!_.isString(content)) {
|
|
17
|
-
// can be empty string
|
|
18
|
-
throw new Error('Pasteboard content is mandatory to set');
|
|
19
|
-
}
|
|
20
|
-
return await /** @type {import('appium-ios-simulator').Simulator} */ (this.device).simctl.setPasteboard(
|
|
21
|
-
content, /** @type {BufferEncoding} */ (encoding)
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Gets the Simulator's pasteboard content.
|
|
27
|
-
*
|
|
28
|
-
* Does not work for real devices.
|
|
29
|
-
* @param {string} encoding - Expected encoding of returned string
|
|
30
|
-
* @group Simulator Only
|
|
31
|
-
* @this {XCUITestDriver}
|
|
32
|
-
* @returns {Promise<string>} The pasteboard content string
|
|
33
|
-
*/
|
|
34
|
-
export async function mobileGetPasteboard(encoding = 'utf8') {
|
|
35
|
-
assertSimulator.call(this, 'Getting pasteboard content');
|
|
36
|
-
return await /** @type {import('appium-ios-simulator').Simulator} */ (this.device).simctl.getPasteboard(
|
|
37
|
-
/** @type {BufferEncoding} */ (encoding)
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
43
|
-
*/
|