appium-xcuitest-driver 10.2.2 → 10.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/build/lib/commands/active-app-info.d.ts +9 -0
- package/build/lib/commands/active-app-info.d.ts.map +1 -0
- package/build/lib/commands/active-app-info.js +14 -0
- package/build/lib/commands/active-app-info.js.map +1 -0
- package/build/lib/commands/alert.d.ts +42 -45
- package/build/lib/commands/alert.d.ts.map +1 -1
- package/build/lib/commands/alert.js +66 -62
- package/build/lib/commands/alert.js.map +1 -1
- package/build/lib/commands/app-management.d.ts +150 -153
- package/build/lib/commands/app-management.d.ts.map +1 -1
- package/build/lib/commands/app-management.js +300 -286
- package/build/lib/commands/app-management.js.map +1 -1
- package/build/lib/commands/app-strings.d.ts +14 -17
- package/build/lib/commands/app-strings.d.ts.map +1 -1
- package/build/lib/commands/app-strings.js +23 -24
- package/build/lib/commands/app-strings.js.map +1 -1
- package/build/lib/commands/appearance.d.ts +19 -22
- package/build/lib/commands/appearance.d.ts.map +1 -1
- package/build/lib/commands/appearance.js +56 -56
- package/build/lib/commands/appearance.js.map +1 -1
- package/build/lib/commands/audit.d.ts +22 -17
- package/build/lib/commands/audit.d.ts.map +1 -1
- package/build/lib/commands/audit.js +17 -18
- package/build/lib/commands/audit.js.map +1 -1
- package/build/lib/commands/battery.d.ts +11 -14
- package/build/lib/commands/battery.d.ts.map +1 -1
- package/build/lib/commands/battery.js +36 -37
- package/build/lib/commands/battery.js.map +1 -1
- package/build/lib/commands/biometric.d.ts +30 -33
- package/build/lib/commands/biometric.d.ts.map +1 -1
- package/build/lib/commands/biometric.js +42 -41
- package/build/lib/commands/biometric.js.map +1 -1
- package/build/lib/commands/certificate.d.ts +48 -45
- package/build/lib/commands/certificate.d.ts.map +1 -1
- package/build/lib/commands/certificate.js +218 -205
- package/build/lib/commands/certificate.js.map +1 -1
- package/build/lib/commands/clipboard.d.ts +19 -22
- package/build/lib/commands/clipboard.d.ts.map +1 -1
- package/build/lib/commands/clipboard.js +30 -30
- package/build/lib/commands/clipboard.js.map +1 -1
- package/build/lib/commands/condition.d.ts +49 -26
- package/build/lib/commands/condition.d.ts.map +1 -1
- package/build/lib/commands/condition.js +87 -86
- package/build/lib/commands/condition.js.map +1 -1
- package/build/lib/commands/content-size.d.ts +26 -29
- package/build/lib/commands/content-size.d.ts.map +1 -1
- package/build/lib/commands/content-size.js +36 -36
- package/build/lib/commands/content-size.js.map +1 -1
- package/build/lib/commands/context.d.ts +161 -108
- package/build/lib/commands/context.d.ts.map +1 -1
- package/build/lib/commands/context.js +530 -517
- package/build/lib/commands/context.js.map +1 -1
- package/build/lib/commands/deviceInfo.d.ts +9 -12
- package/build/lib/commands/deviceInfo.d.ts.map +1 -1
- package/build/lib/commands/deviceInfo.js +17 -18
- package/build/lib/commands/deviceInfo.js.map +1 -1
- package/build/lib/commands/element.d.ts +102 -105
- package/build/lib/commands/element.d.ts.map +1 -1
- package/build/lib/commands/element.js +337 -323
- package/build/lib/commands/element.js.map +1 -1
- package/build/lib/commands/execute.d.ts +24 -19
- package/build/lib/commands/execute.d.ts.map +1 -1
- package/build/lib/commands/execute.js +63 -62
- package/build/lib/commands/execute.js.map +1 -1
- package/build/lib/commands/file-movement.d.ts +77 -80
- package/build/lib/commands/file-movement.d.ts.map +1 -1
- package/build/lib/commands/file-movement.js +130 -124
- package/build/lib/commands/file-movement.js.map +1 -1
- package/build/lib/commands/find.d.ts +18 -21
- package/build/lib/commands/find.d.ts.map +1 -1
- package/build/lib/commands/find.js +158 -156
- package/build/lib/commands/find.js.map +1 -1
- package/build/lib/commands/general.d.ts +124 -116
- package/build/lib/commands/general.d.ts.map +1 -1
- package/build/lib/commands/general.js +248 -232
- package/build/lib/commands/general.js.map +1 -1
- package/build/lib/commands/geolocation.d.ts +43 -46
- package/build/lib/commands/geolocation.d.ts.map +1 -1
- package/build/lib/commands/geolocation.js +10 -11
- package/build/lib/commands/geolocation.js.map +1 -1
- package/build/lib/commands/gesture.d.ts +273 -276
- package/build/lib/commands/gesture.d.ts.map +1 -1
- package/build/lib/commands/gesture.js +506 -492
- package/build/lib/commands/gesture.js.map +1 -1
- package/build/lib/commands/increase-contrast.d.ts +20 -23
- package/build/lib/commands/increase-contrast.d.ts.map +1 -1
- package/build/lib/commands/increase-contrast.js +30 -30
- package/build/lib/commands/increase-contrast.js.map +1 -1
- package/build/lib/commands/iohid.d.ts +1370 -1373
- package/build/lib/commands/iohid.d.ts.map +1 -1
- package/build/lib/commands/iohid.js +30 -31
- package/build/lib/commands/iohid.js.map +1 -1
- package/build/lib/commands/keyboard.d.ts +29 -32
- package/build/lib/commands/keyboard.d.ts.map +1 -1
- package/build/lib/commands/keyboard.js +53 -51
- package/build/lib/commands/keyboard.js.map +1 -1
- package/build/lib/commands/keychains.d.ts +9 -12
- package/build/lib/commands/keychains.d.ts.map +1 -1
- package/build/lib/commands/keychains.js +13 -14
- package/build/lib/commands/keychains.js.map +1 -1
- package/build/lib/commands/localization.d.ts +16 -19
- package/build/lib/commands/localization.d.ts.map +1 -1
- package/build/lib/commands/localization.js +25 -26
- package/build/lib/commands/localization.js.map +1 -1
- package/build/lib/commands/location.d.ts +36 -39
- package/build/lib/commands/location.d.ts.map +1 -1
- package/build/lib/commands/location.js +99 -98
- package/build/lib/commands/location.js.map +1 -1
- package/build/lib/commands/lock.d.ts +21 -24
- package/build/lib/commands/lock.d.ts.map +1 -1
- package/build/lib/commands/lock.js +39 -38
- package/build/lib/commands/lock.js.map +1 -1
- package/build/lib/commands/log.d.ts +43 -37
- package/build/lib/commands/log.d.ts.map +1 -1
- package/build/lib/commands/log.js +174 -171
- package/build/lib/commands/log.js.map +1 -1
- package/build/lib/commands/memory.d.ts +9 -12
- package/build/lib/commands/memory.d.ts.map +1 -1
- package/build/lib/commands/memory.js +37 -39
- package/build/lib/commands/memory.js.map +1 -1
- package/build/lib/commands/navigation.d.ts +30 -33
- package/build/lib/commands/navigation.d.ts.map +1 -1
- package/build/lib/commands/navigation.js +92 -92
- package/build/lib/commands/navigation.js.map +1 -1
- package/build/lib/commands/notifications.d.ts +26 -29
- package/build/lib/commands/notifications.d.ts.map +1 -1
- package/build/lib/commands/notifications.js +53 -53
- package/build/lib/commands/notifications.js.map +1 -1
- package/build/lib/commands/pasteboard.d.ts +21 -24
- package/build/lib/commands/pasteboard.d.ts.map +1 -1
- package/build/lib/commands/pasteboard.js +37 -37
- package/build/lib/commands/pasteboard.js.map +1 -1
- package/build/lib/commands/pcap.d.ts +39 -26
- package/build/lib/commands/pcap.d.ts.map +1 -1
- package/build/lib/commands/pcap.js +81 -81
- package/build/lib/commands/pcap.js.map +1 -1
- package/build/lib/commands/performance.d.ts +63 -44
- package/build/lib/commands/performance.d.ts.map +1 -1
- package/build/lib/commands/performance.js +105 -105
- package/build/lib/commands/performance.js.map +1 -1
- package/build/lib/commands/permissions.d.ts +33 -36
- package/build/lib/commands/permissions.d.ts.map +1 -1
- package/build/lib/commands/permissions.js +66 -65
- package/build/lib/commands/permissions.js.map +1 -1
- package/build/lib/commands/proxy-helper.d.ts +12 -15
- package/build/lib/commands/proxy-helper.d.ts.map +1 -1
- package/build/lib/commands/proxy-helper.js +53 -54
- package/build/lib/commands/proxy-helper.js.map +1 -1
- package/build/lib/commands/record-audio.d.ts +49 -29
- package/build/lib/commands/record-audio.d.ts.map +1 -1
- package/build/lib/commands/record-audio.js +100 -104
- package/build/lib/commands/record-audio.js.map +1 -1
- package/build/lib/commands/recordscreen.d.ts +54 -18
- package/build/lib/commands/recordscreen.d.ts.map +1 -1
- package/build/lib/commands/recordscreen.js +127 -129
- package/build/lib/commands/recordscreen.js.map +1 -1
- package/build/lib/commands/screenshots.d.ts +14 -17
- package/build/lib/commands/screenshots.d.ts.map +1 -1
- package/build/lib/commands/screenshots.js +108 -107
- package/build/lib/commands/screenshots.js.map +1 -1
- package/build/lib/commands/simctl.d.ts +11 -14
- package/build/lib/commands/simctl.d.ts.map +1 -1
- package/build/lib/commands/simctl.js +23 -26
- package/build/lib/commands/simctl.js.map +1 -1
- package/build/lib/commands/source.d.ts +14 -17
- package/build/lib/commands/source.d.ts.map +1 -1
- package/build/lib/commands/source.js +40 -43
- package/build/lib/commands/source.js.map +1 -1
- package/build/lib/commands/timeouts.d.ts +44 -33
- package/build/lib/commands/timeouts.d.ts.map +1 -1
- package/build/lib/commands/timeouts.js +65 -63
- package/build/lib/commands/timeouts.js.map +1 -1
- package/build/lib/commands/web.d.ts +247 -197
- package/build/lib/commands/web.d.ts.map +1 -1
- package/build/lib/commands/web.js +815 -786
- package/build/lib/commands/web.js.map +1 -1
- package/build/lib/commands/xctest-record-screen.d.ts +63 -66
- package/build/lib/commands/xctest-record-screen.d.ts.map +1 -1
- package/build/lib/commands/xctest-record-screen.js +103 -102
- package/build/lib/commands/xctest-record-screen.js.map +1 -1
- package/build/lib/commands/xctest.d.ts +55 -51
- package/build/lib/commands/xctest.d.ts.map +1 -1
- package/build/lib/commands/xctest.js +116 -117
- package/build/lib/commands/xctest.js.map +1 -1
- package/build/lib/driver.d.ts +278 -1597
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/driver.js +320 -236
- package/build/lib/driver.js.map +1 -1
- package/build/lib/execute-method-map.d.ts.map +1 -1
- package/build/lib/execute-method-map.js +9 -0
- package/build/lib/execute-method-map.js.map +1 -1
- package/build/lib/real-device.d.ts +1 -1
- package/build/lib/real-device.d.ts.map +1 -1
- package/build/lib/real-device.js +2 -2
- package/build/lib/real-device.js.map +1 -1
- package/lib/commands/active-app-info.js +12 -0
- package/lib/commands/alert.js +68 -65
- package/lib/commands/app-management.js +308 -301
- package/lib/commands/app-strings.js +24 -26
- package/lib/commands/appearance.js +54 -56
- package/lib/commands/audit.js +18 -20
- package/lib/commands/battery.js +35 -37
- package/lib/commands/biometric.js +44 -46
- package/lib/commands/certificate.js +226 -215
- package/lib/commands/clipboard.js +30 -32
- package/lib/commands/condition.js +98 -100
- package/lib/commands/content-size.js +36 -38
- package/lib/commands/context.js +495 -490
- package/lib/commands/deviceInfo.js +19 -20
- package/lib/commands/element.js +367 -357
- package/lib/commands/execute.js +72 -72
- package/lib/commands/file-movement.js +132 -134
- package/lib/commands/find.js +160 -159
- package/lib/commands/general.js +238 -231
- package/lib/commands/geolocation.js +6 -14
- package/lib/commands/gesture.js +525 -515
- package/lib/commands/increase-contrast.js +30 -32
- package/lib/commands/iohid.js +32 -34
- package/lib/commands/keyboard.js +49 -51
- package/lib/commands/keychains.js +12 -14
- package/lib/commands/localization.js +24 -26
- package/lib/commands/location.js +102 -104
- package/lib/commands/lock.js +38 -38
- package/lib/commands/log.js +197 -198
- package/lib/commands/memory.js +40 -43
- package/lib/commands/navigation.js +96 -100
- package/lib/commands/notifications.js +57 -59
- package/lib/commands/pasteboard.js +37 -39
- package/lib/commands/pcap.js +84 -86
- package/lib/commands/performance.js +132 -133
- package/lib/commands/permissions.js +67 -69
- package/lib/commands/proxy-helper.js +60 -61
- package/lib/commands/record-audio.js +115 -120
- package/lib/commands/recordscreen.js +145 -149
- package/lib/commands/screenshots.js +116 -116
- package/lib/commands/simctl.js +25 -29
- package/lib/commands/source.js +42 -46
- package/lib/commands/timeouts.js +59 -63
- package/lib/commands/web.js +878 -858
- package/lib/commands/xctest-record-screen.js +103 -105
- package/lib/commands/xctest.js +134 -139
- package/lib/driver.js +288 -236
- package/lib/execute-method-map.ts +9 -0
- package/lib/real-device.js +2 -2
- package/npm-shrinkwrap.json +440 -76
- package/package.json +2 -1
- package/build/lib/commands/activeAppInfo.d.ts +0 -12
- package/build/lib/commands/activeAppInfo.d.ts.map +0 -1
- package/build/lib/commands/activeAppInfo.js +0 -15
- package/build/lib/commands/activeAppInfo.js.map +0 -1
- package/build/lib/commands/index.d.ts +0 -96
- package/build/lib/commands/index.d.ts.map +0 -1
- package/build/lib/commands/index.js +0 -100
- package/build/lib/commands/index.js.map +0 -1
- package/build/lib/real-device-clients/devicectl.d.ts +0 -204
- package/build/lib/real-device-clients/devicectl.d.ts.map +0 -1
- package/build/lib/real-device-clients/devicectl.js +0 -264
- package/build/lib/real-device-clients/devicectl.js.map +0 -1
- package/lib/commands/activeAppInfo.js +0 -14
- package/lib/commands/index.js +0 -95
- package/lib/real-device-clients/devicectl.js +0 -291
|
@@ -1,31 +1,29 @@
|
|
|
1
1
|
import {parseLocalizableStrings} from '../app-utils';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
},
|
|
28
|
-
};
|
|
3
|
+
/**
|
|
4
|
+
* Return the language-specific strings for an app
|
|
5
|
+
*
|
|
6
|
+
* @param {string} language - The language abbreviation to fetch app strings mapping for.
|
|
7
|
+
* If no language is provided then strings for the 'en language would be returned
|
|
8
|
+
* @param {string|null} [stringFile=null] - Relative path to the corresponding .strings
|
|
9
|
+
* file starting from the corresponding .lproj folder, e.g., `base/main.strings`. If omitted,
|
|
10
|
+
* then Appium will make its best guess where the file is.
|
|
11
|
+
*
|
|
12
|
+
* @returns {Promise<import('@appium/types').StringRecord<string>>} A record of localized keys to localized text
|
|
13
|
+
*
|
|
14
|
+
* @this {XCUITestDriver}
|
|
15
|
+
*/
|
|
16
|
+
export async function getStrings(language, stringFile = null) {
|
|
17
|
+
this.log.debug(`Gettings strings for language '${language}' and string file '${stringFile}'`);
|
|
18
|
+
return await parseLocalizableStrings.bind(this)(
|
|
19
|
+
{
|
|
20
|
+
...this.opts,
|
|
21
|
+
language,
|
|
22
|
+
stringFile,
|
|
23
|
+
strictMode: true,
|
|
24
|
+
},
|
|
25
|
+
);
|
|
26
|
+
}
|
|
29
27
|
|
|
30
28
|
/**
|
|
31
29
|
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
@@ -1,71 +1,69 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
2
|
import {util} from 'appium/support';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
4
|
+
/**
|
|
5
|
+
* Set the device's UI appearance style
|
|
6
|
+
*
|
|
7
|
+
* @since iOS 12.0
|
|
8
|
+
* @param {'dark'|'light'} style - The appearance style to set
|
|
9
|
+
* @throws {Error} if the current platform does not support UI appearance changes
|
|
10
|
+
* @this {XCUITestDriver}
|
|
11
|
+
*/
|
|
12
|
+
export async function mobileSetAppearance(style) {
|
|
13
|
+
if (!['light', 'dark'].includes(_.toLower(style))) {
|
|
14
|
+
throw new Error(`The 'style' value is expected to equal either 'light' or 'dark'`);
|
|
15
|
+
}
|
|
16
|
+
if (util.compareVersions(/** @type {string} */ (this.opts.platformVersion), '<', '12.0')) {
|
|
17
|
+
throw new Error('Changing appearance is only supported since iOS 12');
|
|
18
|
+
}
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
try {
|
|
23
|
-
return void (await /** @type {import('../driver').Simulator} */ (this.device).setAppearance(style));
|
|
24
|
-
} catch (e) {
|
|
25
|
-
this.log.debug(e.stack);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
20
|
+
if (this.isSimulator()) {
|
|
28
21
|
try {
|
|
29
|
-
return void (await
|
|
22
|
+
return void (await /** @type {import('../driver').Simulator} */ (this.device).setAppearance(style));
|
|
30
23
|
} catch (e) {
|
|
31
24
|
this.log.debug(e.stack);
|
|
32
25
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
return void (await this.proxyCommand('/wda/device/appearance', 'POST', {name: style}, false));
|
|
29
|
+
} catch (e) {
|
|
30
|
+
this.log.debug(e.stack);
|
|
31
|
+
}
|
|
32
|
+
// Fall back to the ugly Siri workaround if the current SDK is too old
|
|
33
|
+
await this.mobileSiriCommand(`Turn ${_.toLower(style) === 'dark' ? 'on' : 'off'} dark mode`);
|
|
34
|
+
}
|
|
36
35
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Get the device's UI appearance style.
|
|
38
|
+
*
|
|
39
|
+
* @since Xcode SDK 11
|
|
40
|
+
* @returns {Promise<{style: Style}>}
|
|
41
|
+
* @this {XCUITestDriver}
|
|
42
|
+
*/
|
|
43
|
+
export async function mobileGetAppearance() {
|
|
44
|
+
if (util.compareVersions(/** @type {string} */ (this.opts.platformVersion), '<', '12.0')) {
|
|
45
|
+
return {style: 'unsupported'};
|
|
46
|
+
}
|
|
48
47
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
style = /** @type {Style} */ (
|
|
54
|
-
await /** @type {import('../driver').Simulator} */ (this.device).getAppearance()
|
|
55
|
-
);
|
|
56
|
-
} catch {}
|
|
57
|
-
}
|
|
58
|
-
if (!style) {
|
|
48
|
+
/** @type {Style|undefined} */
|
|
49
|
+
let style;
|
|
50
|
+
if (this.isSimulator()) {
|
|
51
|
+
try {
|
|
59
52
|
style = /** @type {Style} */ (
|
|
60
|
-
/** @type {
|
|
61
|
-
?.userInterfaceStyle ?? 'unknown'
|
|
53
|
+
await /** @type {import('../driver').Simulator} */ (this.device).getAppearance()
|
|
62
54
|
);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
55
|
+
} catch {}
|
|
56
|
+
}
|
|
57
|
+
if (!style) {
|
|
58
|
+
style = /** @type {Style} */ (
|
|
59
|
+
/** @type {any} */ (await this.proxyCommand('/wda/device/info', 'GET'))
|
|
60
|
+
?.userInterfaceStyle ?? 'unknown'
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
style,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
69
67
|
|
|
70
68
|
/**
|
|
71
69
|
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
package/lib/commands/audit.js
CHANGED
|
@@ -7,26 +7,24 @@
|
|
|
7
7
|
* @property {string} element The description of the element this issue was found for.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
},
|
|
29
|
-
};
|
|
10
|
+
/**
|
|
11
|
+
* Performs accessibility audit of the current application according to the given type or multiple types.
|
|
12
|
+
*
|
|
13
|
+
* @since Xcode 15/iOS 17
|
|
14
|
+
* @param {string[]?} auditTypes - One or more type names to perform the audit for.
|
|
15
|
+
* The full list of available names could be found at
|
|
16
|
+
* https://developer.apple.com/documentation/xctest/xcuiaccessibilityaudittype?language=objc
|
|
17
|
+
* If no type if provided explicitly then XCUIAccessibilityAuditTypeAll is assumed.
|
|
18
|
+
*
|
|
19
|
+
* @returns {Promise<AccessibilityAuditItem[]>} List of found issues or an empty list
|
|
20
|
+
*
|
|
21
|
+
* @this {XCUITestDriver}
|
|
22
|
+
*/
|
|
23
|
+
export async function mobilePerformAccessibilityAudit(auditTypes) {
|
|
24
|
+
return /** @type {AccessibilityAuditItem[]} */ (
|
|
25
|
+
await this.proxyCommand('/wda/performAccessibilityAudit', 'POST', {auditTypes})
|
|
26
|
+
);
|
|
27
|
+
}
|
|
30
28
|
|
|
31
29
|
/**
|
|
32
30
|
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
package/lib/commands/battery.js
CHANGED
|
@@ -1,46 +1,44 @@
|
|
|
1
1
|
import log from '../logger.js';
|
|
2
2
|
import { isIos18OrNewer } from '../utils.js';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
await remoteXPCConnection.close();
|
|
31
|
-
}
|
|
4
|
+
/**
|
|
5
|
+
* Reads the battery information from the device under test.
|
|
6
|
+
*
|
|
7
|
+
* This endpoint only returns reliable result on real devices.
|
|
8
|
+
*
|
|
9
|
+
* @returns {Promise<import('./types').BatteryInfo & {advanced: Record<string, any>}>}
|
|
10
|
+
* @this {import('../driver').XCUITestDriver}
|
|
11
|
+
*/
|
|
12
|
+
export async function mobileGetBatteryInfo() {
|
|
13
|
+
let batteryInfoFromShimService;
|
|
14
|
+
if (isIos18OrNewer(this.opts) && this.isRealDevice()) {
|
|
15
|
+
let remoteXPCConnection;
|
|
16
|
+
try {
|
|
17
|
+
const {Services} = await import('appium-ios-remotexpc');
|
|
18
|
+
let { diagnosticsService, remoteXPC } = await Services.startDiagnosticsService(this.device.udid);
|
|
19
|
+
remoteXPCConnection = remoteXPC;
|
|
20
|
+
batteryInfoFromShimService = await diagnosticsService.ioregistry({
|
|
21
|
+
ioClass: 'IOPMPowerSource',
|
|
22
|
+
returnRawJson: true,
|
|
23
|
+
});
|
|
24
|
+
} catch (err) {
|
|
25
|
+
log.error(`Failed to get battery info from DiagnosticsService: ${err.message}`);
|
|
26
|
+
} finally {
|
|
27
|
+
if (remoteXPCConnection) {
|
|
28
|
+
log.info(`Closing remoteXPC connection for device ${this.device.udid}`);
|
|
29
|
+
await remoteXPCConnection.close();
|
|
32
30
|
}
|
|
33
31
|
}
|
|
32
|
+
}
|
|
34
33
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
};
|
|
34
|
+
const batteryInfoFromWda = /** @type {import('./types').BatteryInfo}} */ (
|
|
35
|
+
await this.proxyCommand('/wda/batteryInfo', 'GET')
|
|
36
|
+
);
|
|
37
|
+
return {
|
|
38
|
+
...batteryInfoFromWda,
|
|
39
|
+
advanced: batteryInfoFromShimService || {},
|
|
40
|
+
};
|
|
41
|
+
}
|
|
44
42
|
|
|
45
43
|
/**
|
|
46
44
|
* @typedef {import('./types').BatteryInfo} BatteryInfo
|
|
@@ -3,52 +3,50 @@ import {assertSimulator as _assertSimulator} from '../utils';
|
|
|
3
3
|
|
|
4
4
|
const assertSimulator = _.partial(_assertSimulator, 'Biometric enrollment');
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
},
|
|
51
|
-
};
|
|
6
|
+
/**
|
|
7
|
+
* Enrolls biometric authentication on a simulated device.
|
|
8
|
+
*
|
|
9
|
+
* @param {boolean} isEnabled - Whether to enable/disable biometric enrollment.
|
|
10
|
+
* @throws {Error} If enrollment fails or the device is not a Simulator.
|
|
11
|
+
* @group Simulator Only
|
|
12
|
+
* @this {XCUITestDriver}
|
|
13
|
+
*/
|
|
14
|
+
export async function mobileEnrollBiometric(isEnabled = true) {
|
|
15
|
+
assertSimulator(this);
|
|
16
|
+
|
|
17
|
+
await /** @type {import('../driver').Simulator} */ (this.device).enrollBiometric(isEnabled);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Emulates biometric match or non-match event on a simulated device.
|
|
22
|
+
*
|
|
23
|
+
* The biometric feature is expected to be already enrolled via {@linkcode mobileEnrollBiometric|mobile: enrollBiometric} before executing this.
|
|
24
|
+
*
|
|
25
|
+
* @param {import('./types').BiometricFeature} type - The biometric feature name.
|
|
26
|
+
* @param {boolean} match - If `true`, simulate biometic match. If `false`, simulate biometric non-match.
|
|
27
|
+
* @throws {Error} If matching fails or the device is not a Simulator.
|
|
28
|
+
* @group Simulator Only
|
|
29
|
+
* @this {XCUITestDriver}
|
|
30
|
+
*/
|
|
31
|
+
export async function mobileSendBiometricMatch(type = 'touchId', match = true) {
|
|
32
|
+
assertSimulator(this);
|
|
33
|
+
|
|
34
|
+
await /** @type {import('../driver').Simulator} */ (this.device).sendBiometricMatch(match, type);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Checks whether the biometric feature is currently enrolled on a simulated device.
|
|
39
|
+
*
|
|
40
|
+
* @returns {Promise<boolean>} `true` if biometric is enrolled.
|
|
41
|
+
* @throws {Error} If the detection fails or the device is not a Simulator.
|
|
42
|
+
* @group Simulator Only
|
|
43
|
+
* @this {XCUITestDriver}
|
|
44
|
+
*/
|
|
45
|
+
export async function mobileIsBiometricEnrolled() {
|
|
46
|
+
assertSimulator(this);
|
|
47
|
+
|
|
48
|
+
return await /** @type {import('../driver').Simulator} */ (this.device).isBiometricEnrolled();
|
|
49
|
+
}
|
|
52
50
|
|
|
53
51
|
/**
|
|
54
52
|
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|