appium-xcuitest-driver 10.14.3 → 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 +12 -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/biometric.d.ts +12 -14
- package/build/lib/commands/biometric.d.ts.map +1 -1
- package/build/lib/commands/biometric.js +10 -19
- package/build/lib/commands/biometric.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/content-size.d.ts +16 -19
- package/build/lib/commands/content-size.d.ts.map +1 -1
- package/build/lib/commands/content-size.js +14 -22
- package/build/lib/commands/content-size.js.map +1 -1
- package/build/lib/commands/geolocation.d.ts +16 -36
- package/build/lib/commands/geolocation.d.ts.map +1 -1
- package/build/lib/commands/geolocation.js +8 -25
- package/build/lib/commands/geolocation.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/iohid.d.ts +6 -1359
- package/build/lib/commands/iohid.d.ts.map +1 -1
- package/build/lib/commands/iohid.js +5 -10
- package/build/lib/commands/iohid.js.map +1 -1
- package/build/lib/commands/keyboard.d.ts +16 -13
- package/build/lib/commands/keyboard.d.ts.map +1 -1
- package/build/lib/commands/keyboard.js +14 -18
- package/build/lib/commands/keyboard.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/notifications.d.ts +10 -10
- package/build/lib/commands/notifications.d.ts.map +1 -1
- package/build/lib/commands/notifications.js +8 -12
- package/build/lib/commands/notifications.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/biometric.ts +52 -0
- package/lib/commands/clipboard.ts +37 -0
- package/lib/commands/content-size.ts +67 -0
- package/lib/commands/geolocation.ts +55 -0
- package/lib/commands/increase-contrast.ts +49 -0
- package/lib/commands/{iohid.js → iohid.ts} +15 -13
- package/lib/commands/keyboard.ts +70 -0
- package/lib/commands/lock.ts +43 -0
- package/lib/commands/{memory.js → memory.ts} +9 -9
- package/lib/commands/{notifications.js → notifications.ts} +22 -14
- package/lib/commands/pasteboard.ts +44 -0
- package/npm-shrinkwrap.json +29 -8
- package/package.json +1 -1
- package/lib/commands/biometric.js +0 -52
- package/lib/commands/clipboard.js +0 -35
- package/lib/commands/content-size.js +0 -68
- package/lib/commands/geolocation.js +0 -56
- package/lib/commands/increase-contrast.js +0 -50
- package/lib/commands/keyboard.js +0 -62
- package/lib/commands/lock.js +0 -46
- package/lib/commands/pasteboard.js +0 -43
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iohid.d.ts","sourceRoot":"","sources":["../../../lib/commands/iohid.
|
|
1
|
+
{"version":3,"file":"iohid.d.ts","sourceRoot":"","sources":["../../../lib/commands/iohid.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,YAAY,EAAC,MAAM,aAAa,CAAC;AACxD,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,WAAW,CAAC;AAE9C;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,YAAY,EAClB,KAAK,EAAE,MAAM,EACb,eAAe,EAAE,MAAM,GAAG,MAAM,GAC/B,OAAO,CAAC,IAAI,CAAC,CAcf"}
|
|
@@ -14,10 +14,9 @@ const hid_event_1 = require("./hid-event");
|
|
|
14
14
|
* - `kHIDUsage_Csmr_Power` = `0x30` (Power)
|
|
15
15
|
* - `kHIDUsage_Csmr_Snapshot` = `0x65` (Power + Home)
|
|
16
16
|
*
|
|
17
|
-
* @param
|
|
18
|
-
* @param
|
|
19
|
-
* @param
|
|
20
|
-
* @this {import('../driver').XCUITestDriver}
|
|
17
|
+
* @param page - The event page identifier
|
|
18
|
+
* @param usage - The event usage identifier (usages are defined per-page)
|
|
19
|
+
* @param durationSeconds - The event duration in float seconds (XCTest uses `0.005` for a single press event)
|
|
21
20
|
*/
|
|
22
21
|
async function mobilePerformIoHidEvent(page, usage, durationSeconds) {
|
|
23
22
|
if (!isHIDPageEvent(page)) {
|
|
@@ -30,12 +29,10 @@ async function mobilePerformIoHidEvent(page, usage, durationSeconds) {
|
|
|
30
29
|
if (Number.isNaN(duration)) {
|
|
31
30
|
throw new driver_1.errors.InvalidArgumentError(`'durationSeconds' argument must be a valid number`);
|
|
32
31
|
}
|
|
33
|
-
|
|
32
|
+
await this.proxyCommand('/wda/performIoHidEvent', 'POST', { page, usage, duration });
|
|
34
33
|
}
|
|
35
34
|
/**
|
|
36
35
|
* Type guard for {@linkcode HIDUsageEvent}
|
|
37
|
-
* @param {any} value
|
|
38
|
-
* @returns {value is HIDUsageEvent}
|
|
39
36
|
*/
|
|
40
37
|
function isHIDUsageEvent(value) {
|
|
41
38
|
if (typeof value === 'string') {
|
|
@@ -48,9 +45,7 @@ function isHIDUsageEvent(value) {
|
|
|
48
45
|
}
|
|
49
46
|
/**
|
|
50
47
|
* Type guard for {@linkcode HIDPageEvent}
|
|
51
|
-
|
|
52
|
-
* @returns {value is HIDPageEvent}
|
|
53
|
-
**/
|
|
48
|
+
*/
|
|
54
49
|
function isHIDPageEvent(value) {
|
|
55
50
|
if (typeof value === 'string') {
|
|
56
51
|
value = parseInt(value, 10);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iohid.js","sourceRoot":"","sources":["../../../lib/commands/iohid.
|
|
1
|
+
{"version":3,"file":"iohid.js","sourceRoot":"","sources":["../../../lib/commands/iohid.ts"],"names":[],"mappings":";;AAmBA,0DAmBC;AAtCD,0CAAqC;AACrC,2CAAwD;AAGxD;;;;;;;;;;;;;;GAcG;AACI,KAAK,UAAU,uBAAuB,CAE3C,IAAkB,EAClB,KAAa,EACb,eAAgC;IAEhC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,eAAM,CAAC,oBAAoB,CACnC,yDAAyD,CAC1D,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,eAAM,CAAC,oBAAoB,CAAC,kDAAkD,CAAC,CAAC;IAC5F,CAAC;IACD,MAAM,QAAQ,GAAG,UAAU,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC;IACrD,IAAI,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,eAAM,CAAC,oBAAoB,CAAC,mDAAmD,CAAC,CAAC;IAC7F,CAAC;IACD,MAAM,IAAI,CAAC,YAAY,CAAC,wBAAwB,EAAE,MAAM,EAAE,EAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAC,CAAC,CAAC;AACrF,CAAC;AAED;;GAEG;AACH,SAAS,eAAe,CAAC,KAAU;IACjC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,KAAK,GAAG,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC9B,CAAC;IACD,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACrD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,KAAK,IAAI,yBAAa,CAAC;AAChC,CAAC;AAED;;GAEG;AACH,SAAS,cAAc,CAAC,KAAU;IAChC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,KAAK,GAAG,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC9B,CAAC;IACD,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACrD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,KAAK,IAAI,wBAAY,CAAC;AAC/B,CAAC"}
|
|
@@ -1,32 +1,35 @@
|
|
|
1
|
+
import type { XCUITestDriver } from '../driver';
|
|
2
|
+
import type { KeyboardKey } from './types';
|
|
1
3
|
/**
|
|
2
|
-
*
|
|
4
|
+
* Hides the keyboard.
|
|
5
|
+
*
|
|
3
6
|
* @deprecated
|
|
4
7
|
*/
|
|
5
|
-
export function hideKeyboard(this:
|
|
8
|
+
export declare function hideKeyboard(this: XCUITestDriver, strategy?: string, ...possibleKeys: string[]): Promise<boolean>;
|
|
6
9
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
10
|
+
* Hides the keyboard using the specified key names.
|
|
11
|
+
*
|
|
12
|
+
* @param keys - Array of key names to use for dismissing the keyboard
|
|
9
13
|
*/
|
|
10
|
-
export function mobileHideKeyboard(this:
|
|
14
|
+
export declare function mobileHideKeyboard(this: XCUITestDriver, keys?: string[]): Promise<void>;
|
|
11
15
|
/**
|
|
12
|
-
*
|
|
16
|
+
* Checks whether the keyboard is currently shown.
|
|
17
|
+
*
|
|
18
|
+
* @returns `true` if the keyboard is shown, `false` otherwise
|
|
13
19
|
*/
|
|
14
|
-
export function isKeyboardShown(this:
|
|
20
|
+
export declare function isKeyboardShown(this: XCUITestDriver): Promise<boolean>;
|
|
15
21
|
/**
|
|
16
22
|
* Send keys to the given element or to the application under test.
|
|
17
23
|
* This API is not supported on tvOS
|
|
18
24
|
*
|
|
19
25
|
* @since Xcode 15/iOS 17
|
|
20
|
-
* @
|
|
21
|
-
* @param {(Key|string)[]} keys Array of keys to type.
|
|
26
|
+
* @param keys - Array of keys to type.
|
|
22
27
|
* Each item could either be a string, that represents a key itself (see
|
|
23
28
|
* https://developer.apple.com/documentation/xctest/xcuielement/1500604-typekey?language=objc
|
|
24
29
|
* and https://developer.apple.com/documentation/xctest/xcuikeyboardkey?language=objc)
|
|
25
30
|
* or a dictionary, if the key should also be entered with modifiers.
|
|
26
|
-
* @param
|
|
31
|
+
* @param elementId - UUID of the element to send keys to.
|
|
27
32
|
* If the element is not provided then the keys will be sent to the current application.
|
|
28
33
|
*/
|
|
29
|
-
export function mobileKeys(this:
|
|
30
|
-
export type XCUITestDriver = import("../driver").XCUITestDriver;
|
|
31
|
-
export type Key = import("./types").KeyboardKey;
|
|
34
|
+
export declare function mobileKeys(this: XCUITestDriver, keys: (KeyboardKey | string)[], elementId?: string | null): Promise<void>;
|
|
32
35
|
//# sourceMappingURL=keyboard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyboard.d.ts","sourceRoot":"","sources":["../../../lib/commands/keyboard.
|
|
1
|
+
{"version":3,"file":"keyboard.d.ts","sourceRoot":"","sources":["../../../lib/commands/keyboard.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;AAEzC;;;;GAIG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,cAAc,EACpB,QAAQ,CAAC,EAAE,MAAM,EACjB,GAAG,YAAY,EAAE,MAAM,EAAE,GACxB,OAAO,CAAC,OAAO,CAAC,CAKlB;AAED;;;;GAIG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,cAAc,EACpB,IAAI,GAAE,MAAM,EAAO,GAClB,OAAO,CAAC,IAAI,CAAC,CAIf;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,CAO5E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,UAAU,CAC9B,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,CAAC,WAAW,GAAG,MAAM,CAAC,EAAE,EAC9B,SAAS,GAAE,MAAM,GAAG,IAAW,GAC9B,OAAO,CAAC,IAAI,CAAC,CAGf"}
|
|
@@ -9,7 +9,8 @@ exports.isKeyboardShown = isKeyboardShown;
|
|
|
9
9
|
exports.mobileKeys = mobileKeys;
|
|
10
10
|
const lodash_1 = __importDefault(require("lodash"));
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* Hides the keyboard.
|
|
13
|
+
*
|
|
13
14
|
* @deprecated
|
|
14
15
|
*/
|
|
15
16
|
async function hideKeyboard(strategy, ...possibleKeys) {
|
|
@@ -19,17 +20,19 @@ async function hideKeyboard(strategy, ...possibleKeys) {
|
|
|
19
20
|
return true;
|
|
20
21
|
}
|
|
21
22
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
23
|
+
* Hides the keyboard using the specified key names.
|
|
24
|
+
*
|
|
25
|
+
* @param keys - Array of key names to use for dismissing the keyboard
|
|
24
26
|
*/
|
|
25
27
|
async function mobileHideKeyboard(keys = []) {
|
|
26
|
-
|
|
27
|
-
keys.
|
|
28
|
-
}
|
|
29
|
-
await this.proxyCommand('/wda/keyboard/dismiss', 'POST', { keyNames: keys });
|
|
28
|
+
await this.proxyCommand('/wda/keyboard/dismiss', 'POST', {
|
|
29
|
+
keyNames: keys.includes('done') ? keys : [...keys, 'done'],
|
|
30
|
+
});
|
|
30
31
|
}
|
|
31
32
|
/**
|
|
32
|
-
*
|
|
33
|
+
* Checks whether the keyboard is currently shown.
|
|
34
|
+
*
|
|
35
|
+
* @returns `true` if the keyboard is shown, `false` otherwise
|
|
33
36
|
*/
|
|
34
37
|
async function isKeyboardShown() {
|
|
35
38
|
try {
|
|
@@ -45,23 +48,16 @@ async function isKeyboardShown() {
|
|
|
45
48
|
* This API is not supported on tvOS
|
|
46
49
|
*
|
|
47
50
|
* @since Xcode 15/iOS 17
|
|
48
|
-
* @
|
|
49
|
-
* @param {(Key|string)[]} keys Array of keys to type.
|
|
51
|
+
* @param keys - Array of keys to type.
|
|
50
52
|
* Each item could either be a string, that represents a key itself (see
|
|
51
53
|
* https://developer.apple.com/documentation/xctest/xcuielement/1500604-typekey?language=objc
|
|
52
54
|
* and https://developer.apple.com/documentation/xctest/xcuikeyboardkey?language=objc)
|
|
53
55
|
* or a dictionary, if the key should also be entered with modifiers.
|
|
54
|
-
* @param
|
|
56
|
+
* @param elementId - UUID of the element to send keys to.
|
|
55
57
|
* If the element is not provided then the keys will be sent to the current application.
|
|
56
58
|
*/
|
|
57
59
|
async function mobileKeys(keys, elementId = null) {
|
|
58
60
|
const url = `/wda/element/${elementId || 0}/keyboardInput`;
|
|
59
|
-
|
|
61
|
+
await this.proxyCommand(url, 'POST', { keys });
|
|
60
62
|
}
|
|
61
|
-
/**
|
|
62
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
63
|
-
*/
|
|
64
|
-
/**
|
|
65
|
-
* @typedef {import('./types').KeyboardKey} Key
|
|
66
|
-
*/
|
|
67
63
|
//# sourceMappingURL=keyboard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyboard.js","sourceRoot":"","sources":["../../../lib/commands/keyboard.
|
|
1
|
+
{"version":3,"file":"keyboard.js","sourceRoot":"","sources":["../../../lib/commands/keyboard.ts"],"names":[],"mappings":";;;;;AASA,oCASC;AAOD,gDAOC;AAOD,0CAOC;AAeD,gCAOC;AApED,oDAAuB;AAIvB;;;;GAIG;AACI,KAAK,UAAU,YAAY,CAEhC,QAAiB,EACjB,GAAG,YAAsB;IAEzB,mCAAmC;IACnC,MAAM,QAAQ,GAAG,gBAAC,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACzE,MAAM,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IACxC,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;GAIG;AACI,KAAK,UAAU,kBAAkB,CAEtC,OAAiB,EAAE;IAEnB,MAAM,IAAI,CAAC,YAAY,CAAC,uBAAuB,EAAE,MAAM,EAAE;QACvD,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC;KAC3D,CAAC,CAAC;AACL,CAAC;AAED;;;;GAIG;AACI,KAAK,UAAU,eAAe;IACnC,IAAI,CAAC;QACH,MAAM,IAAI,CAAC,2BAA2B,CAAC,YAAY,EAAE,yBAAyB,EAAE,KAAK,CAAC,CAAC;QACvF,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;GAYG;AACI,KAAK,UAAU,UAAU,CAE9B,IAA8B,EAC9B,YAA2B,IAAI;IAE/B,MAAM,GAAG,GAAG,gBAAgB,SAAS,IAAI,CAAC,gBAAgB,CAAC;IAC3D,MAAM,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;AACjD,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,15 +1,17 @@
|
|
|
1
|
+
import type { XCUITestDriver } from '../driver';
|
|
2
|
+
import type { PushPayload, NotificationType } from './types';
|
|
1
3
|
/**
|
|
2
4
|
* Simulates push notification delivery to a simulated device.
|
|
3
5
|
*
|
|
4
6
|
* **Only "remote" push notifications are supported.** VoIP, Complication, File Provider, and other types are unsupported.
|
|
5
7
|
*
|
|
6
8
|
* Supported in Xcode SDK 11.4+.
|
|
7
|
-
*
|
|
8
|
-
* @param
|
|
9
|
+
*
|
|
10
|
+
* @param bundleId - The bundle identifier of the target application
|
|
11
|
+
* @param payload - Valid push payload.
|
|
9
12
|
* @group Simulator Only
|
|
10
|
-
* @this {XCUITestDriver}
|
|
11
13
|
*/
|
|
12
|
-
export function mobilePushNotification(this:
|
|
14
|
+
export declare function mobilePushNotification(this: XCUITestDriver, bundleId: string, payload: PushPayload): Promise<void>;
|
|
13
15
|
/**
|
|
14
16
|
* Blocks until the expected notification is delivered.
|
|
15
17
|
*
|
|
@@ -17,12 +19,10 @@ export function mobilePushNotification(this: import("../driver").XCUITestDriver,
|
|
|
17
19
|
* [`XCTNSNotificationExpectation`](https://developer.apple.com/documentation/xctest/xctnsnotificationexpectation?language=objc) and
|
|
18
20
|
* [`XCTDarwinNotificationExpectation`](https://developer.apple.com/documentation/xctest/xctdarwinnotificationexpectation?language=objc) entities.
|
|
19
21
|
*
|
|
20
|
-
* @param
|
|
21
|
-
* @param
|
|
22
|
-
* @param
|
|
22
|
+
* @param name - The name of the notification to expect
|
|
23
|
+
* @param type - Which notification type to expect.
|
|
24
|
+
* @param timeoutSeconds - For how long to wait until the notification is delivered (in float seconds).
|
|
23
25
|
* @throws A [`TimeoutError`](https://www.selenium.dev/selenium/docs/api/javascript/module/selenium-webdriver/lib/error_exports_TimeoutError.html) if the expected notification has not been delivered within the given timeout.
|
|
24
|
-
* @this {XCUITestDriver}
|
|
25
26
|
*/
|
|
26
|
-
export function mobileExpectNotification(this:
|
|
27
|
-
export type XCUITestDriver = import("../driver").XCUITestDriver;
|
|
27
|
+
export declare function mobileExpectNotification(this: XCUITestDriver, name: string, type?: NotificationType, timeoutSeconds?: number): Promise<void>;
|
|
28
28
|
//# sourceMappingURL=notifications.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../../lib/commands/notifications.
|
|
1
|
+
{"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../../lib/commands/notifications.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAC,WAAW,EAAE,gBAAgB,EAAC,MAAM,SAAS,CAAC;AAG3D;;;;;;;;;;GAUG;AACH,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,cAAc,EACpB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CA0Bf;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,gBAA0B,EAChC,cAAc,GAAE,MAAW,GAC1B,OAAO,CAAC,IAAI,CAAC,CAMf"}
|
|
@@ -13,10 +13,10 @@ const lodash_1 = __importDefault(require("lodash"));
|
|
|
13
13
|
* **Only "remote" push notifications are supported.** VoIP, Complication, File Provider, and other types are unsupported.
|
|
14
14
|
*
|
|
15
15
|
* Supported in Xcode SDK 11.4+.
|
|
16
|
-
*
|
|
17
|
-
* @param
|
|
16
|
+
*
|
|
17
|
+
* @param bundleId - The bundle identifier of the target application
|
|
18
|
+
* @param payload - Valid push payload.
|
|
18
19
|
* @group Simulator Only
|
|
19
|
-
* @this {XCUITestDriver}
|
|
20
20
|
*/
|
|
21
21
|
async function mobilePushNotification(bundleId, payload) {
|
|
22
22
|
if (!this.isSimulator()) {
|
|
@@ -33,7 +33,7 @@ async function mobilePushNotification(bundleId, payload) {
|
|
|
33
33
|
throw new driver_1.errors.InvalidArgumentError(`The 'payload.aps' value must be a valid dictionary. ` +
|
|
34
34
|
`Got ${JSON.stringify(payload.aps)} instead`);
|
|
35
35
|
}
|
|
36
|
-
|
|
36
|
+
await this.device.pushNotification({
|
|
37
37
|
...payload,
|
|
38
38
|
'Simulator Target Bundle': bundleId,
|
|
39
39
|
});
|
|
@@ -45,20 +45,16 @@ async function mobilePushNotification(bundleId, payload) {
|
|
|
45
45
|
* [`XCTNSNotificationExpectation`](https://developer.apple.com/documentation/xctest/xctnsnotificationexpectation?language=objc) and
|
|
46
46
|
* [`XCTDarwinNotificationExpectation`](https://developer.apple.com/documentation/xctest/xctdarwinnotificationexpectation?language=objc) entities.
|
|
47
47
|
*
|
|
48
|
-
* @param
|
|
49
|
-
* @param
|
|
50
|
-
* @param
|
|
48
|
+
* @param name - The name of the notification to expect
|
|
49
|
+
* @param type - Which notification type to expect.
|
|
50
|
+
* @param timeoutSeconds - For how long to wait until the notification is delivered (in float seconds).
|
|
51
51
|
* @throws A [`TimeoutError`](https://www.selenium.dev/selenium/docs/api/javascript/module/selenium-webdriver/lib/error_exports_TimeoutError.html) if the expected notification has not been delivered within the given timeout.
|
|
52
|
-
* @this {XCUITestDriver}
|
|
53
52
|
*/
|
|
54
53
|
async function mobileExpectNotification(name, type = 'plain', timeoutSeconds = 60) {
|
|
55
|
-
|
|
54
|
+
await this.proxyCommand('/wda/expectNotification', 'POST', {
|
|
56
55
|
name,
|
|
57
56
|
type,
|
|
58
57
|
timeout: timeoutSeconds,
|
|
59
58
|
});
|
|
60
59
|
}
|
|
61
|
-
/**
|
|
62
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
63
|
-
*/
|
|
64
60
|
//# sourceMappingURL=notifications.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications.js","sourceRoot":"","sources":["../../../lib/commands/notifications.
|
|
1
|
+
{"version":3,"file":"notifications.js","sourceRoot":"","sources":["../../../lib/commands/notifications.ts"],"names":[],"mappings":";;;;;AAiBA,wDA8BC;AAcD,4DAWC;AAxED,0CAAqC;AACrC,oDAAuB;AAKvB;;;;;;;;;;GAUG;AACI,KAAK,UAAU,sBAAsB,CAE1C,QAAgB,EAChB,OAAoB;IAEpB,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAC5D,CAAC;IAED,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,eAAM,CAAC,oBAAoB,CACnC,8DAA8D,CAC/D,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,gBAAC,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,eAAM,CAAC,oBAAoB,CACnC,2DAA2D;YACzD,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,CAC3C,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,gBAAC,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,eAAM,CAAC,oBAAoB,CACnC,sDAAsD;YACpD,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAC/C,CAAC;IACJ,CAAC;IACD,MAAO,IAAI,CAAC,MAAoB,CAAC,gBAAgB,CAAC;QAChD,GAAG,OAAO;QACV,yBAAyB,EAAE,QAAQ;KACpC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;GAWG;AACI,KAAK,UAAU,wBAAwB,CAE5C,IAAY,EACZ,OAAyB,OAAO,EAChC,iBAAyB,EAAE;IAE3B,MAAM,IAAI,CAAC,YAAY,CAAC,yBAAyB,EAAE,MAAM,EAAE;QACzD,IAAI;QACJ,IAAI;QACJ,OAAO,EAAE,cAAc;KACxB,CAAC,CAAC;AACL,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
|
-
*/
|