appium-xcuitest-driver 10.3.0 → 10.4.1
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 -38
- 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 +275 -197
- package/build/lib/commands/web.d.ts.map +1 -1
- package/build/lib/commands/web.js +866 -785
- 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 +277 -1597
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/driver.js +318 -235
- 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/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 -42
- 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 +932 -859
- package/lib/commands/xctest-record-screen.js +103 -105
- package/lib/commands/xctest.js +134 -139
- package/lib/driver.js +286 -235
- package/lib/execute-method-map.ts +9 -0
- package/npm-shrinkwrap.json +8 -8
- package/package.json +1 -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/cookies.d.ts +0 -15
- package/build/lib/cookies.d.ts.map +0 -1
- package/build/lib/cookies.js +0 -84
- package/build/lib/cookies.js.map +0 -1
- package/lib/commands/activeAppInfo.js +0 -14
- package/lib/commands/index.js +0 -95
- package/lib/cookies.js +0 -92
|
@@ -1,6 +1,104 @@
|
|
|
1
1
|
import {INSTRUMENT_CHANNEL, services} from 'appium-ios-device';
|
|
2
2
|
import _ from 'lodash';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Get all available ConditionInducer configuration information, which can be used with
|
|
6
|
+
* {@linkcode XCUITestDriver.enableConditionInducer}
|
|
7
|
+
* @returns {Promise<Condition[]>}
|
|
8
|
+
* @since 4.9.0
|
|
9
|
+
* @see {@link https://help.apple.com/xcode/mac/current/#/dev308429d42}
|
|
10
|
+
* @this {XCUITestDriver}
|
|
11
|
+
*/
|
|
12
|
+
export async function listConditionInducers() {
|
|
13
|
+
requireConditionInducerCompatibleDevice.bind(this);
|
|
14
|
+
const conditionInducerService = await services.startInstrumentService(this.device.udid);
|
|
15
|
+
try {
|
|
16
|
+
const ret = await conditionInducerService.callChannel(
|
|
17
|
+
INSTRUMENT_CHANNEL.CONDITION_INDUCER,
|
|
18
|
+
'availableConditionInducers',
|
|
19
|
+
);
|
|
20
|
+
return ret.selector;
|
|
21
|
+
} finally {
|
|
22
|
+
conditionInducerService.close();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Enable a "condition inducer". You can create a condition on a connected device to test your app under adverse conditions,
|
|
28
|
+
* such as poor network connectivity or thermal constraints. When you start a device condition,
|
|
29
|
+
* the operating system on the device behaves as if its environment has changed. The device
|
|
30
|
+
* condition remains active until you stop the device condition or disconnect the device. For
|
|
31
|
+
* example, you can start a device condition, run your app, monitor your app's energy usage, and
|
|
32
|
+
* then stop the condition.
|
|
33
|
+
*
|
|
34
|
+
* (Note: the socket needs to remain connected during operation)
|
|
35
|
+
* (Note: Device conditions are available only for real devices running iOS 13.0 and later.)
|
|
36
|
+
*
|
|
37
|
+
* @param {string} conditionID - Determine which condition IDs are available with the {@linkcode XCUITestDriver.listConditionInducers} command
|
|
38
|
+
* @param {string} profileID - Determine which profile IDs are available with the {@linkcode XCUITestDriver.listConditionInducers} command
|
|
39
|
+
* @returns {Promise<boolean>} `true` if enabling the condition succeeded
|
|
40
|
+
* @throws {Error} If you try to start another Condition and the previous Condition has not stopped
|
|
41
|
+
* @since 4.9.0
|
|
42
|
+
* @see {@link https://help.apple.com/xcode/mac/current/#/dev308429d42}
|
|
43
|
+
* @this {XCUITestDriver}
|
|
44
|
+
*/
|
|
45
|
+
export async function enableConditionInducer(conditionID, profileID) {
|
|
46
|
+
requireConditionInducerCompatibleDevice.bind(this);
|
|
47
|
+
if (this._conditionInducerService && !this._conditionInducerService._socketClient.destroyed) {
|
|
48
|
+
throw this.log.errorWithException(
|
|
49
|
+
`Condition inducer has been started. A condition is already active.`
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
this._conditionInducerService = await services.startInstrumentService(this.device.udid);
|
|
53
|
+
const ret = await this._conditionInducerService.callChannel(
|
|
54
|
+
INSTRUMENT_CHANNEL.CONDITION_INDUCER,
|
|
55
|
+
'enableConditionWithIdentifier:profileIdentifier:',
|
|
56
|
+
conditionID,
|
|
57
|
+
profileID,
|
|
58
|
+
);
|
|
59
|
+
if (!_.isBoolean(ret.selector)) {
|
|
60
|
+
this._conditionInducerService.close();
|
|
61
|
+
this._conditionInducerService = null;
|
|
62
|
+
throw this.log.errorWithException(`Enable condition inducer error: '${JSON.stringify(ret.selector)}'`);
|
|
63
|
+
}
|
|
64
|
+
return ret.selector;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Disable a condition inducer enabled with {@linkcode XCUITestDriver.enableConditionInducer} Usually
|
|
69
|
+
* a persistent connection is maintained after the condition inducer is enabled, and this method
|
|
70
|
+
* is only valid for the currently enabled connection. If the connection is disconnected, the
|
|
71
|
+
* condition inducer will be automatically disabled
|
|
72
|
+
*
|
|
73
|
+
* (Note: this is also automatically called upon session cleanup)
|
|
74
|
+
* @returns {Promise<boolean>} `true` if disable the condition succeeded
|
|
75
|
+
* @since 4.9.0
|
|
76
|
+
* @see {@link https://help.apple.com/xcode/mac/current/#/dev308429d42}
|
|
77
|
+
* @this {XCUITestDriver}
|
|
78
|
+
*/
|
|
79
|
+
export async function disableConditionInducer() {
|
|
80
|
+
if (!this._conditionInducerService) {
|
|
81
|
+
this.log.warn('Condition inducer server is not started');
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
try {
|
|
85
|
+
const ret = await this._conditionInducerService.callChannel(
|
|
86
|
+
INSTRUMENT_CHANNEL.CONDITION_INDUCER,
|
|
87
|
+
'disableActiveCondition',
|
|
88
|
+
);
|
|
89
|
+
if (!_.isBoolean(ret.selector)) {
|
|
90
|
+
this.log.warn(`Disable condition inducer error: '${JSON.stringify(ret.selector)}'`);
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
return ret.selector;
|
|
94
|
+
} finally {
|
|
95
|
+
if (this._conditionInducerService) {
|
|
96
|
+
this._conditionInducerService.close();
|
|
97
|
+
this._conditionInducerService = null;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
4
102
|
/**
|
|
5
103
|
* @this {XCUITestDriver}
|
|
6
104
|
* @returns {void}
|
|
@@ -52,106 +150,6 @@ function requireConditionInducerCompatibleDevice() {
|
|
|
52
150
|
* }
|
|
53
151
|
*/
|
|
54
152
|
|
|
55
|
-
export default {
|
|
56
|
-
/**
|
|
57
|
-
* Get all available ConditionInducer configuration information, which can be used with
|
|
58
|
-
* {@linkcode XCUITestDriver.enableConditionInducer}
|
|
59
|
-
* @returns {Promise<Condition[]>}
|
|
60
|
-
* @since 4.9.0
|
|
61
|
-
* @see {@link https://help.apple.com/xcode/mac/current/#/dev308429d42}
|
|
62
|
-
* @this {XCUITestDriver}
|
|
63
|
-
*/
|
|
64
|
-
async listConditionInducers() {
|
|
65
|
-
requireConditionInducerCompatibleDevice.bind(this);
|
|
66
|
-
const conditionInducerService = await services.startInstrumentService(this.device.udid);
|
|
67
|
-
try {
|
|
68
|
-
const ret = await conditionInducerService.callChannel(
|
|
69
|
-
INSTRUMENT_CHANNEL.CONDITION_INDUCER,
|
|
70
|
-
'availableConditionInducers',
|
|
71
|
-
);
|
|
72
|
-
return ret.selector;
|
|
73
|
-
} finally {
|
|
74
|
-
conditionInducerService.close();
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Enable a "condition inducer". You can create a condition on a connected device to test your app under adverse conditions,
|
|
80
|
-
* such as poor network connectivity or thermal constraints. When you start a device condition,
|
|
81
|
-
* the operating system on the device behaves as if its environment has changed. The device
|
|
82
|
-
* condition remains active until you stop the device condition or disconnect the device. For
|
|
83
|
-
* example, you can start a device condition, run your app, monitor your app’s energy usage, and
|
|
84
|
-
* then stop the condition.
|
|
85
|
-
*
|
|
86
|
-
* (Note: the socket needs to remain connected during operation)
|
|
87
|
-
* (Note: Device conditions are available only for real devices running iOS 13.0 and later.)
|
|
88
|
-
*
|
|
89
|
-
* @param {string} conditionID - Determine which condition IDs are available with the {@linkcode XCUITestDriver.listConditionInducers} command
|
|
90
|
-
* @param {string} profileID - Determine which profile IDs are available with the {@linkcode XCUITestDriver.listConditionInducers} command
|
|
91
|
-
* @returns {Promise<boolean>} `true` if enabling the condition succeeded
|
|
92
|
-
* @throws {Error} If you try to start another Condition and the previous Condition has not stopped
|
|
93
|
-
* @since 4.9.0
|
|
94
|
-
* @see {@link https://help.apple.com/xcode/mac/current/#/dev308429d42}
|
|
95
|
-
* @this {XCUITestDriver}
|
|
96
|
-
*/
|
|
97
|
-
async enableConditionInducer(conditionID, profileID) {
|
|
98
|
-
requireConditionInducerCompatibleDevice.bind(this);
|
|
99
|
-
if (this._conditionInducerService && !this._conditionInducerService._socketClient.destroyed) {
|
|
100
|
-
throw this.log.errorWithException(
|
|
101
|
-
`Condition inducer has been started. A condition is already active.`
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
this._conditionInducerService = await services.startInstrumentService(this.device.udid);
|
|
105
|
-
const ret = await this._conditionInducerService.callChannel(
|
|
106
|
-
INSTRUMENT_CHANNEL.CONDITION_INDUCER,
|
|
107
|
-
'enableConditionWithIdentifier:profileIdentifier:',
|
|
108
|
-
conditionID,
|
|
109
|
-
profileID,
|
|
110
|
-
);
|
|
111
|
-
if (!_.isBoolean(ret.selector)) {
|
|
112
|
-
this._conditionInducerService.close();
|
|
113
|
-
this._conditionInducerService = null;
|
|
114
|
-
throw this.log.errorWithException(`Enable condition inducer error: '${JSON.stringify(ret.selector)}'`);
|
|
115
|
-
}
|
|
116
|
-
return ret.selector;
|
|
117
|
-
},
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Disable a condition inducer enabled with {@linkcode XCUITestDriver.enableConditionInducer} Usually
|
|
121
|
-
* a persistent connection is maintained after the condition inducer is enabled, and this method
|
|
122
|
-
* is only valid for the currently enabled connection. If the connection is disconnected, the
|
|
123
|
-
* condition inducer will be automatically disabled
|
|
124
|
-
*
|
|
125
|
-
* (Note: this is also automatically called upon session cleanup)
|
|
126
|
-
* @returns {Promise<boolean>} `true` if disable the condition succeeded
|
|
127
|
-
* @since 4.9.0
|
|
128
|
-
* @see {@link https://help.apple.com/xcode/mac/current/#/dev308429d42}
|
|
129
|
-
* @this {XCUITestDriver}
|
|
130
|
-
*/
|
|
131
|
-
async disableConditionInducer() {
|
|
132
|
-
if (!this._conditionInducerService) {
|
|
133
|
-
this.log.warn('Condition inducer server is not started');
|
|
134
|
-
return false;
|
|
135
|
-
}
|
|
136
|
-
try {
|
|
137
|
-
const ret = await this._conditionInducerService.callChannel(
|
|
138
|
-
INSTRUMENT_CHANNEL.CONDITION_INDUCER,
|
|
139
|
-
'disableActiveCondition',
|
|
140
|
-
);
|
|
141
|
-
if (!_.isBoolean(ret.selector)) {
|
|
142
|
-
this.log.warn(`Disable condition inducer error: '${JSON.stringify(ret.selector)}'`);
|
|
143
|
-
return false;
|
|
144
|
-
}
|
|
145
|
-
return ret.selector;
|
|
146
|
-
} finally {
|
|
147
|
-
if (this._conditionInducerService) {
|
|
148
|
-
this._conditionInducerService.close();
|
|
149
|
-
this._conditionInducerService = null;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
},
|
|
153
|
-
};
|
|
154
|
-
|
|
155
153
|
/**
|
|
156
154
|
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
157
155
|
*/
|
|
@@ -21,47 +21,45 @@ const CONTENT_SIZE = [
|
|
|
21
21
|
'decrement'
|
|
22
22
|
];
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const simulator = assertSimulator(this);
|
|
24
|
+
/**
|
|
25
|
+
* Sets content size for the given simulator.
|
|
26
|
+
*
|
|
27
|
+
* @since Xcode 15 (but lower xcode could have this command)
|
|
28
|
+
* @param {ContentSizeAction} size - The content size action to set. Acceptable value is
|
|
29
|
+
* extra-small, small, medium, large, extra-large, extra-extra-large,
|
|
30
|
+
* extra-extra-extra-large, accessibility-medium, accessibility-large,
|
|
31
|
+
* accessibility-extra-large, accessibility-extra-extra-large,
|
|
32
|
+
* accessibility-extra-extra-extra-large with Xcode 16.2.
|
|
33
|
+
* @throws {Error} if the current platform does not support content size appearance changes
|
|
34
|
+
* @this {XCUITestDriver}
|
|
35
|
+
*/
|
|
36
|
+
export async function mobileSetContentSize(size) {
|
|
37
|
+
const simulator = assertSimulator(this);
|
|
39
38
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
if (!CONTENT_SIZE.includes(_.lowerCase(size))) {
|
|
40
|
+
throw new errors.InvalidArgumentError(
|
|
41
|
+
`The 'size' value is expected to be one of ${CONTENT_SIZE.join(',')}`
|
|
42
|
+
);
|
|
43
|
+
}
|
|
45
44
|
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
await simulator.setContentSize(size);
|
|
46
|
+
}
|
|
48
47
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
};
|
|
48
|
+
/**
|
|
49
|
+
* Retrieves the current content size value from the given simulator.
|
|
50
|
+
*
|
|
51
|
+
* @since Xcode 15 (but lower xcode could have this command)
|
|
52
|
+
* @returns {Promise<ContentSizeResult>} the content size value. Possible return value is
|
|
53
|
+
* extra-small, small, medium, large, extra-large, extra-extra-large,
|
|
54
|
+
* extra-extra-extra-large, accessibility-medium, accessibility-large,
|
|
55
|
+
* accessibility-extra-large, accessibility-extra-extra-large,
|
|
56
|
+
* accessibility-extra-extra-extra-large,
|
|
57
|
+
* unknown or unsupported with Xcode 16.2.
|
|
58
|
+
* @this {XCUITestDriver}
|
|
59
|
+
*/
|
|
60
|
+
export async function mobileGetContentSize() {
|
|
61
|
+
return /** @type {ContentSizeResult} */ (await assertSimulator(this).getContentSize());
|
|
62
|
+
}
|
|
65
63
|
|
|
66
64
|
/**
|
|
67
65
|
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|