appium-xcuitest-driver 10.14.0 → 10.14.2
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/condition.d.ts +9 -72
- package/build/lib/commands/condition.d.ts.map +1 -1
- package/build/lib/commands/condition.js +5 -66
- package/build/lib/commands/condition.js.map +1 -1
- package/build/lib/commands/execute.d.ts +10 -22
- package/build/lib/commands/execute.d.ts.map +1 -1
- package/build/lib/commands/execute.js +12 -28
- package/build/lib/commands/execute.js.map +1 -1
- package/build/lib/commands/location.d.ts +8 -11
- package/build/lib/commands/location.d.ts.map +1 -1
- package/build/lib/commands/location.js +7 -15
- package/build/lib/commands/location.js.map +1 -1
- package/build/lib/commands/navigation.d.ts +14 -26
- package/build/lib/commands/navigation.d.ts.map +1 -1
- package/build/lib/commands/navigation.js +10 -18
- package/build/lib/commands/navigation.js.map +1 -1
- package/build/lib/commands/pcap.d.ts +18 -38
- package/build/lib/commands/pcap.d.ts.map +1 -1
- package/build/lib/commands/pcap.js +9 -14
- package/build/lib/commands/pcap.js.map +1 -1
- package/build/lib/commands/record-audio.d.ts +25 -53
- package/build/lib/commands/record-audio.d.ts.map +1 -1
- package/build/lib/commands/record-audio.js +17 -19
- package/build/lib/commands/record-audio.js.map +1 -1
- package/build/lib/commands/screenshots.d.ts +15 -9
- package/build/lib/commands/screenshots.d.ts.map +1 -1
- package/build/lib/commands/screenshots.js +13 -11
- package/build/lib/commands/screenshots.js.map +1 -1
- package/build/lib/commands/source.d.ts +10 -8
- package/build/lib/commands/source.d.ts.map +1 -1
- package/build/lib/commands/source.js +11 -14
- package/build/lib/commands/source.js.map +1 -1
- package/build/lib/commands/types.d.ts +58 -0
- package/build/lib/commands/types.d.ts.map +1 -1
- package/build/lib/commands/xctest-record-screen.d.ts +17 -47
- package/build/lib/commands/xctest-record-screen.d.ts.map +1 -1
- package/build/lib/commands/xctest-record-screen.js +28 -59
- package/build/lib/commands/xctest-record-screen.js.map +1 -1
- package/build/lib/driver.d.ts +1 -1
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/driver.js +1 -1
- 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 +0 -6
- package/build/lib/execute-method-map.js.map +1 -1
- package/lib/commands/{condition.js → condition.ts} +21 -77
- package/lib/commands/{execute.js → execute.ts} +41 -37
- package/lib/commands/{location.js → location.ts} +19 -22
- package/lib/commands/{navigation.js → navigation.ts} +23 -26
- package/lib/commands/{pcap.js → pcap.ts} +28 -28
- package/lib/commands/{record-audio.js → record-audio.ts} +35 -33
- package/lib/commands/{screenshots.js → screenshots.ts} +24 -16
- package/lib/commands/{source.js → source.ts} +23 -20
- package/lib/commands/types.ts +63 -0
- package/lib/commands/{xctest-record-screen.js → xctest-record-screen.ts} +54 -71
- package/lib/driver.ts +2 -2
- package/lib/execute-method-map.ts +0 -6
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## [10.14.2](https://github.com/appium/appium-xcuitest-driver/compare/v10.14.1...v10.14.2) (2026-01-01)
|
|
2
|
+
|
|
3
|
+
### Miscellaneous Chores
|
|
4
|
+
|
|
5
|
+
* Migrate various command modules to typescript (part 6) ([#2692](https://github.com/appium/appium-xcuitest-driver/issues/2692)) ([3736824](https://github.com/appium/appium-xcuitest-driver/commit/37368246181f2e4096ce80ae76e3d458ea39c711))
|
|
6
|
+
|
|
7
|
+
## [10.14.1](https://github.com/appium/appium-xcuitest-driver/compare/v10.14.0...v10.14.1) (2025-12-31)
|
|
8
|
+
|
|
9
|
+
### Miscellaneous Chores
|
|
10
|
+
|
|
11
|
+
* Migrate various command modules to typescript (part 5) ([#2691](https://github.com/appium/appium-xcuitest-driver/issues/2691)) ([0cd46fd](https://github.com/appium/appium-xcuitest-driver/commit/0cd46fdc6fb62df5ee61e8008f53a65f1aec4c5d))
|
|
12
|
+
|
|
1
13
|
## [10.14.0](https://github.com/appium/appium-xcuitest-driver/compare/v10.13.4...v10.14.0) (2025-12-30)
|
|
2
14
|
|
|
3
15
|
### Features
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import type { XCUITestDriver } from '../driver';
|
|
2
|
+
import type { Condition } from './types';
|
|
1
3
|
/**
|
|
2
4
|
* Get all available ConditionInducer configuration information, which can be used with
|
|
3
5
|
* {@linkcode XCUITestDriver.enableConditionInducer}
|
|
4
|
-
* @returns {Promise<Condition[]>}
|
|
5
6
|
* @since 4.9.0
|
|
6
7
|
* @see {@link https://help.apple.com/xcode/mac/current/#/dev308429d42}
|
|
7
|
-
* @this {XCUITestDriver}
|
|
8
8
|
*/
|
|
9
|
-
export function listConditionInducers(this:
|
|
9
|
+
export declare function listConditionInducers(this: XCUITestDriver): Promise<Condition[]>;
|
|
10
10
|
/**
|
|
11
11
|
* Enable a "condition inducer". You can create a condition on a connected device to test your app under adverse conditions,
|
|
12
12
|
* such as poor network connectivity or thermal constraints. When you start a device condition,
|
|
@@ -18,39 +18,14 @@ export function listConditionInducers(this: import("../driver").XCUITestDriver):
|
|
|
18
18
|
* (Note: the socket needs to remain connected during operation)
|
|
19
19
|
* (Note: Device conditions are available only for real devices running iOS 13.0 and later.)
|
|
20
20
|
*
|
|
21
|
-
* @param
|
|
22
|
-
* @param
|
|
23
|
-
* @returns
|
|
21
|
+
* @param conditionID - Determine which condition IDs are available with the {@linkcode XCUITestDriver.listConditionInducers} command
|
|
22
|
+
* @param profileID - Determine which profile IDs are available with the {@linkcode XCUITestDriver.listConditionInducers} command
|
|
23
|
+
* @returns `true` if enabling the condition succeeded
|
|
24
24
|
* @throws {Error} If you try to start another Condition and the previous Condition has not stopped
|
|
25
25
|
* @since 4.9.0
|
|
26
26
|
* @see {@link https://help.apple.com/xcode/mac/current/#/dev308429d42}
|
|
27
|
-
* @this {XCUITestDriver}
|
|
28
27
|
*/
|
|
29
|
-
export function enableConditionInducer(this:
|
|
30
|
-
export class enableConditionInducer {
|
|
31
|
-
/**
|
|
32
|
-
* Enable a "condition inducer". You can create a condition on a connected device to test your app under adverse conditions,
|
|
33
|
-
* such as poor network connectivity or thermal constraints. When you start a device condition,
|
|
34
|
-
* the operating system on the device behaves as if its environment has changed. The device
|
|
35
|
-
* condition remains active until you stop the device condition or disconnect the device. For
|
|
36
|
-
* example, you can start a device condition, run your app, monitor your app's energy usage, and
|
|
37
|
-
* then stop the condition.
|
|
38
|
-
*
|
|
39
|
-
* (Note: the socket needs to remain connected during operation)
|
|
40
|
-
* (Note: Device conditions are available only for real devices running iOS 13.0 and later.)
|
|
41
|
-
*
|
|
42
|
-
* @param {string} conditionID - Determine which condition IDs are available with the {@linkcode XCUITestDriver.listConditionInducers} command
|
|
43
|
-
* @param {string} profileID - Determine which profile IDs are available with the {@linkcode XCUITestDriver.listConditionInducers} command
|
|
44
|
-
* @returns {Promise<boolean>} `true` if enabling the condition succeeded
|
|
45
|
-
* @throws {Error} If you try to start another Condition and the previous Condition has not stopped
|
|
46
|
-
* @since 4.9.0
|
|
47
|
-
* @see {@link https://help.apple.com/xcode/mac/current/#/dev308429d42}
|
|
48
|
-
* @this {XCUITestDriver}
|
|
49
|
-
*/
|
|
50
|
-
constructor(this: import("../driver").XCUITestDriver, conditionID: string, profileID: string);
|
|
51
|
-
_remoteXPCConditionInducerConnection: import("appium-ios-remotexpc", { with: { "resolution-mode": "import" } }).DVTServiceWithConnection | undefined;
|
|
52
|
-
_conditionInducerService: any;
|
|
53
|
-
}
|
|
28
|
+
export declare function enableConditionInducer(this: XCUITestDriver, conditionID: string, profileID: string): Promise<boolean>;
|
|
54
29
|
/**
|
|
55
30
|
* Disable a condition inducer enabled with {@linkcode XCUITestDriver.enableConditionInducer} Usually
|
|
56
31
|
* a persistent connection is maintained after the condition inducer is enabled, and this method
|
|
@@ -58,47 +33,9 @@ export class enableConditionInducer {
|
|
|
58
33
|
* condition inducer will be automatically disabled
|
|
59
34
|
*
|
|
60
35
|
* (Note: this is also automatically called upon session cleanup)
|
|
61
|
-
* @returns
|
|
36
|
+
* @returns `true` if disable the condition succeeded
|
|
62
37
|
* @since 4.9.0
|
|
63
38
|
* @see {@link https://help.apple.com/xcode/mac/current/#/dev308429d42}
|
|
64
|
-
* @this {XCUITestDriver}
|
|
65
39
|
*/
|
|
66
|
-
export function disableConditionInducer(this:
|
|
67
|
-
export class disableConditionInducer {
|
|
68
|
-
_conditionInducerService: any;
|
|
69
|
-
}
|
|
70
|
-
export type DVTServiceWithConnection = import("appium-ios-remotexpc", { with: { "resolution-mode": "import" } }).DVTServiceWithConnection;
|
|
71
|
-
export type Profile = {
|
|
72
|
-
name: string;
|
|
73
|
-
/**
|
|
74
|
-
* the property is profileID used in {@linkcode XCUITestDriver.enableConditionInducer}
|
|
75
|
-
*/
|
|
76
|
-
identifier: string;
|
|
77
|
-
/**
|
|
78
|
-
* Configuration details
|
|
79
|
-
*/
|
|
80
|
-
description: string;
|
|
81
|
-
};
|
|
82
|
-
/**
|
|
83
|
-
* We can use the returned data to determine whether the Condition is enabled and the currently enabled configuration information
|
|
84
|
-
*/
|
|
85
|
-
export type Condition = {
|
|
86
|
-
profiles: Profile[];
|
|
87
|
-
/**
|
|
88
|
-
* the property is conditionID used in {@linkcode XCUITestDriver.enableConditionInducer}
|
|
89
|
-
*/
|
|
90
|
-
identifier: string;
|
|
91
|
-
profilesSorted: boolean;
|
|
92
|
-
isDestructive: boolean;
|
|
93
|
-
isInternal: boolean;
|
|
94
|
-
/**
|
|
95
|
-
* `true` if this condition identifier is enabled
|
|
96
|
-
*/
|
|
97
|
-
isActive: boolean;
|
|
98
|
-
/**
|
|
99
|
-
* enabled profiles identifier
|
|
100
|
-
*/
|
|
101
|
-
activeProfile: string;
|
|
102
|
-
};
|
|
103
|
-
export type XCUITestDriver = import("../driver").XCUITestDriver;
|
|
40
|
+
export declare function disableConditionInducer(this: XCUITestDriver): Promise<boolean>;
|
|
104
41
|
//# sourceMappingURL=condition.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"condition.d.ts","sourceRoot":"","sources":["../../../lib/commands/condition.
|
|
1
|
+
{"version":3,"file":"condition.d.ts","sourceRoot":"","sources":["../../../lib/commands/condition.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,WAAW,CAAC;AAE9C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAEvC;;;;;GAKG;AACH,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CA2BtF;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,cAAc,EACpB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,OAAO,CAAC,CA0ClB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,uBAAuB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,CA0CpF"}
|
|
@@ -12,10 +12,8 @@ const utils_1 = require("../utils");
|
|
|
12
12
|
/**
|
|
13
13
|
* Get all available ConditionInducer configuration information, which can be used with
|
|
14
14
|
* {@linkcode XCUITestDriver.enableConditionInducer}
|
|
15
|
-
* @returns {Promise<Condition[]>}
|
|
16
15
|
* @since 4.9.0
|
|
17
16
|
* @see {@link https://help.apple.com/xcode/mac/current/#/dev308429d42}
|
|
18
|
-
* @this {XCUITestDriver}
|
|
19
17
|
*/
|
|
20
18
|
async function listConditionInducers() {
|
|
21
19
|
requireConditionInducerCompatibleDevice.call(this);
|
|
@@ -23,7 +21,7 @@ async function listConditionInducers() {
|
|
|
23
21
|
const dvtConnection = await startRemoteXPC(this.device.udid);
|
|
24
22
|
try {
|
|
25
23
|
const result = await dvtConnection.conditionInducer.list();
|
|
26
|
-
return
|
|
24
|
+
return result;
|
|
27
25
|
}
|
|
28
26
|
catch (err) {
|
|
29
27
|
this.log.error(`Failed to list condition inducers via RemoteXPC: ${err.message}`);
|
|
@@ -54,13 +52,12 @@ async function listConditionInducers() {
|
|
|
54
52
|
* (Note: the socket needs to remain connected during operation)
|
|
55
53
|
* (Note: Device conditions are available only for real devices running iOS 13.0 and later.)
|
|
56
54
|
*
|
|
57
|
-
* @param
|
|
58
|
-
* @param
|
|
59
|
-
* @returns
|
|
55
|
+
* @param conditionID - Determine which condition IDs are available with the {@linkcode XCUITestDriver.listConditionInducers} command
|
|
56
|
+
* @param profileID - Determine which profile IDs are available with the {@linkcode XCUITestDriver.listConditionInducers} command
|
|
57
|
+
* @returns `true` if enabling the condition succeeded
|
|
60
58
|
* @throws {Error} If you try to start another Condition and the previous Condition has not stopped
|
|
61
59
|
* @since 4.9.0
|
|
62
60
|
* @see {@link https://help.apple.com/xcode/mac/current/#/dev308429d42}
|
|
63
|
-
* @this {XCUITestDriver}
|
|
64
61
|
*/
|
|
65
62
|
async function enableConditionInducer(conditionID, profileID) {
|
|
66
63
|
requireConditionInducerCompatibleDevice.call(this);
|
|
@@ -99,10 +96,9 @@ async function enableConditionInducer(conditionID, profileID) {
|
|
|
99
96
|
* condition inducer will be automatically disabled
|
|
100
97
|
*
|
|
101
98
|
* (Note: this is also automatically called upon session cleanup)
|
|
102
|
-
* @returns
|
|
99
|
+
* @returns `true` if disable the condition succeeded
|
|
103
100
|
* @since 4.9.0
|
|
104
101
|
* @see {@link https://help.apple.com/xcode/mac/current/#/dev308429d42}
|
|
105
|
-
* @this {XCUITestDriver}
|
|
106
102
|
*/
|
|
107
103
|
async function disableConditionInducer() {
|
|
108
104
|
requireConditionInducerCompatibleDevice.call(this);
|
|
@@ -144,76 +140,19 @@ async function disableConditionInducer() {
|
|
|
144
140
|
}
|
|
145
141
|
}
|
|
146
142
|
}
|
|
147
|
-
/**
|
|
148
|
-
* @this {XCUITestDriver}
|
|
149
|
-
* @returns {void}
|
|
150
|
-
*/
|
|
151
143
|
function requireConditionInducerCompatibleDevice() {
|
|
152
144
|
if (this.isSimulator()) {
|
|
153
145
|
throw this.log.errorWithException('Condition inducer only works on real devices');
|
|
154
146
|
}
|
|
155
147
|
}
|
|
156
|
-
/**
|
|
157
|
-
* @param {string} udid
|
|
158
|
-
* @returns {Promise<DVTServiceWithConnection>}
|
|
159
|
-
*/
|
|
160
148
|
async function startRemoteXPC(udid) {
|
|
161
149
|
const { Services } = await import('appium-ios-remotexpc');
|
|
162
150
|
return Services.startDVTService(udid);
|
|
163
151
|
}
|
|
164
|
-
/**
|
|
165
|
-
* @this {XCUITestDriver}
|
|
166
|
-
* @returns {Promise<void>}
|
|
167
|
-
*/
|
|
168
152
|
async function closeRemoteXPC() {
|
|
169
153
|
if (this._remoteXPCConditionInducerConnection) {
|
|
170
154
|
await this._remoteXPCConditionInducerConnection.remoteXPC.close();
|
|
171
155
|
this._remoteXPCConditionInducerConnection = null;
|
|
172
156
|
}
|
|
173
157
|
}
|
|
174
|
-
/**
|
|
175
|
-
* @typedef {import('appium-ios-remotexpc', {with: {'resolution-mode': 'import'}}).DVTServiceWithConnection} DVTServiceWithConnection
|
|
176
|
-
*/
|
|
177
|
-
/**
|
|
178
|
-
* @typedef {Object} Profile
|
|
179
|
-
* @property {string} name
|
|
180
|
-
* @property {string} identifier the property is profileID used in {@linkcode XCUITestDriver.enableConditionInducer}
|
|
181
|
-
* @property {string} description Configuration details
|
|
182
|
-
*/
|
|
183
|
-
/**
|
|
184
|
-
* We can use the returned data to determine whether the Condition is enabled and the currently enabled configuration information
|
|
185
|
-
* @typedef {Object} Condition
|
|
186
|
-
* @property {Profile[]} profiles
|
|
187
|
-
* @property {string} identifier the property is conditionID used in {@linkcode XCUITestDriver.enableConditionInducer}
|
|
188
|
-
* @property {boolean} profilesSorted
|
|
189
|
-
* @property {boolean} isDestructive
|
|
190
|
-
* @property {boolean} isInternal
|
|
191
|
-
* @property {boolean} isActive `true` if this condition identifier is enabled
|
|
192
|
-
* @property {string} activeProfile enabled profiles identifier
|
|
193
|
-
* @example {
|
|
194
|
-
* "profiles": [
|
|
195
|
-
* {
|
|
196
|
-
* "name": "100% packet loss",
|
|
197
|
-
* "identifier": "SlowNetwork100PctLoss", // MobileEnableConditionInducer profileID
|
|
198
|
-
* "description": "Name: 100% Loss Scenario\n
|
|
199
|
-
* Downlink Bandwidth: 0 Mbps\n
|
|
200
|
-
* Downlink Latency:0 ms\n
|
|
201
|
-
* Downlink Packet Loss Ratio: 100%\n
|
|
202
|
-
* Uplink Bandwidth: 0 Mbps\n
|
|
203
|
-
* Uplink Latency: 0 ms\n
|
|
204
|
-
* Uplink Packet Loss Ratio: 100%"
|
|
205
|
-
* }
|
|
206
|
-
* ],
|
|
207
|
-
* "profilesSorted": true,
|
|
208
|
-
* "identifier": "SlowNetworkCondition", // MobileEnableConditionInducer conditionID
|
|
209
|
-
* "isDestructive": false,
|
|
210
|
-
* "isInternal": false,
|
|
211
|
-
* "activeProfile": "",
|
|
212
|
-
* "name": "Network Link",
|
|
213
|
-
* "isActive": false
|
|
214
|
-
* }
|
|
215
|
-
*/
|
|
216
|
-
/**
|
|
217
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
218
|
-
*/
|
|
219
158
|
//# sourceMappingURL=condition.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"condition.js","sourceRoot":"","sources":["../../../lib/commands/condition.
|
|
1
|
+
{"version":3,"file":"condition.js","sourceRoot":"","sources":["../../../lib/commands/condition.ts"],"names":[],"mappings":";;;;;AAaA,sDA2BC;AAoBD,wDA8CC;AAaD,0DA0CC;AAjKD,yDAA+D;AAC/D,oDAAuB;AACvB,oCAA0C;AAK1C;;;;;GAKG;AACI,KAAK,UAAU,qBAAqB;IACzC,uCAAuC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEnD,IAAI,IAAA,sBAAc,EAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9B,MAAM,aAAa,GAAG,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AAC,gBAAC,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC/B,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,qCAAqC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;YACpF,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAO,GAAG,CAAC,QAAQ,CAAC;IACtB,CAAC;YAAS,CAAC;QACT,IAAI,IAAI,CAAC,wBAAwB,EAAE,CAAC;YAClC,IAAI,CAAC,wBAAwB,CAAC,KAAK,EAAE,CAAC;YACtC,IAAI,CAAC,wBAAwB,GAAG,IAAI,CAAC;QACvC,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,uCAAuC;IAC9C,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;QACvB,MAAM,IAAI,CAAC,GAAG,CAAC,kBAAkB,CAAC,8CAA8C,CAAC,CAAC;IACpF,CAAC;AACH,CAAC;AAED,KAAK,UAAU,cAAc,CAAC,IAAY;IACxC,MAAM,EAAC,QAAQ,EAAC,GAAG,MAAM,MAAM,CAAC,sBAAsB,CAAC,CAAC;IACxD,OAAO,QAAQ,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;AACxC,CAAC;AAED,KAAK,UAAU,cAAc;IAC3B,IAAI,IAAI,CAAC,oCAAoC,EAAE,CAAC;QAC9C,MAAM,IAAI,CAAC,oCAAoC,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;QAClE,IAAI,CAAC,oCAAoC,GAAG,IAAI,CAAC;IACnD,CAAC;AACH,CAAC"}
|
|
@@ -1,33 +1,21 @@
|
|
|
1
|
+
import { XCUITestDriver } from '../driver';
|
|
2
|
+
import type { StringRecord } from '@appium/types';
|
|
1
3
|
/**
|
|
2
4
|
* Collect the response of an async script execution
|
|
3
|
-
* @this {XCUITestDriver}
|
|
4
5
|
* @deprecated
|
|
5
6
|
* @privateRemarks It's unclear what this is for. Don't use it.
|
|
6
7
|
*/
|
|
7
|
-
export function receiveAsyncResponse(this: XCUITestDriver, status:
|
|
8
|
+
export declare function receiveAsyncResponse(this: XCUITestDriver, status: number | null | undefined, value: any): Promise<void>;
|
|
8
9
|
/**
|
|
9
|
-
* @template
|
|
10
|
-
* @
|
|
11
|
-
* @param
|
|
12
|
-
* @param {TArgs} [args]
|
|
13
|
-
* @this {XCUITestDriver}
|
|
14
|
-
* @returns {Promise<TReturn>}
|
|
10
|
+
* @template TReturn
|
|
11
|
+
* @param script - Either a script to run, or in the case of an Execute Method, the name of the script to execute.
|
|
12
|
+
* @param args
|
|
15
13
|
*/
|
|
16
|
-
export function execute<
|
|
14
|
+
export declare function execute<TReturn = unknown>(this: XCUITestDriver, script: string, args?: ExecuteMethodArgs): Promise<TReturn>;
|
|
17
15
|
/**
|
|
18
|
-
* @this {XCUITestDriver}
|
|
19
16
|
* @group Mobile Web Only
|
|
20
17
|
*/
|
|
21
|
-
export function executeAsync(this: XCUITestDriver, script:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
* @this {XCUITestDriver}
|
|
25
|
-
* @group Mobile Web Only
|
|
26
|
-
*/
|
|
27
|
-
constructor(this: XCUITestDriver, script: any, args: any);
|
|
28
|
-
asyncWaitMs: number;
|
|
29
|
-
}
|
|
30
|
-
export type StringRecord<T = any> = import("@appium/types").StringRecord<T>;
|
|
31
|
-
export type ExecuteMethodArgs = readonly any[] | readonly [StringRecord] | Readonly<StringRecord>;
|
|
32
|
-
import { XCUITestDriver } from '../driver';
|
|
18
|
+
export declare function executeAsync(this: XCUITestDriver, script: string, args?: readonly any[]): Promise<any>;
|
|
19
|
+
type ExecuteMethodArgs = readonly any[] | readonly [StringRecord<unknown>] | Readonly<StringRecord<unknown>>;
|
|
20
|
+
export {};
|
|
33
21
|
//# sourceMappingURL=execute.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../lib/commands/execute.
|
|
1
|
+
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../lib/commands/execute.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,cAAc,EAAC,MAAM,WAAW,CAAC;AAGzC,OAAO,KAAK,EAAU,YAAY,EAAC,MAAM,eAAe,CAAC;AAEzD;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACjC,KAAK,EAAE,GAAG,GACT,OAAO,CAAC,IAAI,CAAC,CAqBf;AAED;;;;GAIG;AACH,wBAAsB,OAAO,CAAC,OAAO,GAAG,OAAO,EAC7C,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,iBAAiB,GACvB,OAAO,CAAC,OAAO,CAAC,CAalB;AAED;;GAEG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,SAAS,GAAG,EAAE,GACpB,OAAO,CAAC,GAAG,CAAC,CAad;AA0ED,KAAK,iBAAiB,GAAG,SAAS,GAAG,EAAE,GAAG,SAAS,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,GAAG,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC"}
|
|
@@ -12,7 +12,6 @@ const driver_2 = require("appium/driver");
|
|
|
12
12
|
const support_1 = require("appium/support");
|
|
13
13
|
/**
|
|
14
14
|
* Collect the response of an async script execution
|
|
15
|
-
* @this {XCUITestDriver}
|
|
16
15
|
* @deprecated
|
|
17
16
|
* @privateRemarks It's unclear what this is for. Don't use it.
|
|
18
17
|
*/
|
|
@@ -34,12 +33,9 @@ async function receiveAsyncResponse(status, value) {
|
|
|
34
33
|
return this.asyncPromise.resolve(value);
|
|
35
34
|
}
|
|
36
35
|
/**
|
|
37
|
-
* @template
|
|
38
|
-
* @
|
|
39
|
-
* @param
|
|
40
|
-
* @param {TArgs} [args]
|
|
41
|
-
* @this {XCUITestDriver}
|
|
42
|
-
* @returns {Promise<TReturn>}
|
|
36
|
+
* @template TReturn
|
|
37
|
+
* @param script - Either a script to run, or in the case of an Execute Method, the name of the script to execute.
|
|
38
|
+
* @param args
|
|
43
39
|
*/
|
|
44
40
|
async function execute(script, args) {
|
|
45
41
|
// TODO: create a type that converts args to the parameters of the associated method using the `command` prop of `executeMethodMap`
|
|
@@ -49,7 +45,7 @@ async function execute(script, args) {
|
|
|
49
45
|
return await this.executeMethod(script, [executeMethodArgs]);
|
|
50
46
|
}
|
|
51
47
|
else if (this.isWebContext()) {
|
|
52
|
-
const atomsArgs = this.convertElementsForAtoms(
|
|
48
|
+
const atomsArgs = this.convertElementsForAtoms(args);
|
|
53
49
|
const result = await this.executeAtom('execute_script', [script, atomsArgs]);
|
|
54
50
|
return this.cacheWebElements(result);
|
|
55
51
|
}
|
|
@@ -58,7 +54,6 @@ async function execute(script, args) {
|
|
|
58
54
|
}
|
|
59
55
|
}
|
|
60
56
|
/**
|
|
61
|
-
* @this {XCUITestDriver}
|
|
62
57
|
* @group Mobile Web Only
|
|
63
58
|
*/
|
|
64
59
|
async function executeAsync(script, args) {
|
|
@@ -72,15 +67,13 @@ async function executeAsync(script, args) {
|
|
|
72
67
|
}
|
|
73
68
|
/**
|
|
74
69
|
* Checks if script expects a particular parameter (either optional or required).
|
|
75
|
-
* @template
|
|
76
|
-
* @param
|
|
77
|
-
* @param
|
|
70
|
+
* @template Script
|
|
71
|
+
* @param script - Script name
|
|
72
|
+
* @param param - Parameter name
|
|
78
73
|
* @returns {boolean}
|
|
79
74
|
*/
|
|
80
75
|
function executeMethodExpectsParam(script, param) {
|
|
81
|
-
/** @type {ReadonlyArray<string>|undefined} */
|
|
82
76
|
let required;
|
|
83
|
-
/** @type {ReadonlyArray<string>|undefined} */
|
|
84
77
|
let optional;
|
|
85
78
|
const execMethodDef = driver_1.XCUITestDriver.executeMethodMap[script];
|
|
86
79
|
if ('params' in execMethodDef) {
|
|
@@ -95,7 +88,7 @@ function executeMethodExpectsParam(script, param) {
|
|
|
95
88
|
return allParams.has(param);
|
|
96
89
|
}
|
|
97
90
|
/**
|
|
98
|
-
* @param
|
|
91
|
+
* @param script
|
|
99
92
|
* @returns {script is keyof XCUITestDriver.executeMethodMap}
|
|
100
93
|
*/
|
|
101
94
|
function isExecuteMethod(script) {
|
|
@@ -103,15 +96,14 @@ function isExecuteMethod(script) {
|
|
|
103
96
|
}
|
|
104
97
|
/**
|
|
105
98
|
* Massages the arguments going into an execute method.
|
|
106
|
-
* @param
|
|
107
|
-
* @param
|
|
108
|
-
* @returns {StringRecord<unknown>}
|
|
99
|
+
* @param script
|
|
100
|
+
* @param args
|
|
109
101
|
*/
|
|
110
102
|
function preprocessExecuteMethodArgs(script, args) {
|
|
111
103
|
if (lodash_1.default.isArray(args)) {
|
|
112
104
|
args = lodash_1.default.first(args);
|
|
113
105
|
}
|
|
114
|
-
const executeMethodArgs =
|
|
106
|
+
const executeMethodArgs = (args ?? {});
|
|
115
107
|
/**
|
|
116
108
|
* Renames the deprecated `element` key to `elementId`. Historically,
|
|
117
109
|
* all of the pre-Execute-Method-Map execute methods accepted an `element` _or_ and `elementId` param.
|
|
@@ -127,16 +119,8 @@ function preprocessExecuteMethodArgs(script, args) {
|
|
|
127
119
|
* Most of these Execute Methods (typically beginning with `mobile*`) will accept an `Element|string` for `elementId`, in practice they will only ever get a `string`. `Element|string` in the method's docstring is simply for documentation purposes.
|
|
128
120
|
*/
|
|
129
121
|
if ('elementId' in executeMethodArgs && executeMethodExpectsParam(script, 'elementId')) {
|
|
130
|
-
executeMethodArgs.elementId = support_1.util.unwrapElement(
|
|
131
|
-
/** @type {import('@appium/types').Element|string} */ (executeMethodArgs.elementId));
|
|
122
|
+
executeMethodArgs.elementId = support_1.util.unwrapElement(executeMethodArgs.elementId);
|
|
132
123
|
}
|
|
133
124
|
return executeMethodArgs;
|
|
134
125
|
}
|
|
135
|
-
/**
|
|
136
|
-
* @template [T=any]
|
|
137
|
-
* @typedef {import('@appium/types').StringRecord<T>} StringRecord
|
|
138
|
-
*/
|
|
139
|
-
/**
|
|
140
|
-
* @typedef {readonly any[] | readonly [StringRecord] | Readonly<StringRecord>} ExecuteMethodArgs
|
|
141
|
-
*/
|
|
142
126
|
//# sourceMappingURL=execute.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../lib/commands/execute.
|
|
1
|
+
{"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../lib/commands/execute.ts"],"names":[],"mappings":";;;;;AAWA,oDAyBC;AAOD,0BAiBC;AAKD,oCAiBC;AAlFD,oDAAuB;AACvB,sCAAyC;AACzC,0CAA0E;AAC1E,4CAAoC;AAGpC;;;;GAIG;AACI,KAAK,UAAU,oBAAoB,CAExC,MAAiC,EACjC,KAAU;IAEV,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,4BAA4B,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACpE,IAAI,CAAC,cAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;QACtC,IAAI,CAAC,GAAG,CAAC,IAAI,CACX,0DAA0D;YACxD,iBAAiB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAC3C,CAAC;QACF,OAAO;IACT,CAAC;IAED,IAAI,cAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1C,UAAU;QACV,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,IAAA,sBAAa,EAAC,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IACxE,CAAC;IACD,IAAI,CAAC,cAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,KAAK,IAAI,gBAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;Q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,2BAA2B,CAClC,MAAoD,EACpD,IAAwB;IAExB,IAAI,gBAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACpB,IAAI,GAAG,gBAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IACD,MAAM,iBAAiB,GAAG,CAAC,IAAI,IAAI,EAAE,CAA0B,CAAC;IAChE;;;;OAIG;IACH,IAAI,CAAC,CAAC,WAAW,IAAI,iBAAiB,CAAC,IAAI,SAAS,IAAI,iBAAiB,EAAE,CAAC;QAC1E,iBAAiB,CAAC,SAAS,GAAG,iBAAiB,CAAC,OAAO,CAAC;QACxD,OAAO,iBAAiB,CAAC,OAAO,CAAC;IACnC,CAAC;IAED;;;;OAIG;IACH,IAAI,WAAW,IAAI,iBAAiB,IAAI,yBAAyB,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,CAAC;QACvF,iBAAiB,CAAC,SAAS,GAAG,cAAI,CAAC,aAAa,CAC9C,iBAAiB,CAAC,SAAqC,CACxD,CAAC;IACJ,CAAC;IAED,OAAO,iBAAiB,CAAC;AAC3B,CAAC"}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import type { XCUITestDriver } from '../driver';
|
|
2
|
+
import type { Location } from '@appium/types';
|
|
3
|
+
import type { LocationWithAltitude } from './types';
|
|
1
4
|
/**
|
|
2
5
|
* Returns location of the device under test.
|
|
3
6
|
* The device under test must allow the location services for WDA
|
|
@@ -11,31 +14,25 @@
|
|
|
11
14
|
* "mobile:getSimulatedLocation" if the simulated location has been previously set
|
|
12
15
|
* "mobile:setSimulatedLocation" already.
|
|
13
16
|
*
|
|
14
|
-
* @returns
|
|
17
|
+
* @returns Location with altitude
|
|
15
18
|
* @throws {Error} If the device under test returns an error message.
|
|
16
19
|
* i.e.: tvOS returns unsupported error
|
|
17
|
-
* @this {XCUITestDriver}
|
|
18
20
|
*/
|
|
19
|
-
export function getGeoLocation(this:
|
|
21
|
+
export declare function getGeoLocation(this: XCUITestDriver): Promise<LocationWithAltitude>;
|
|
20
22
|
/**
|
|
21
23
|
* Set location of the device under test.
|
|
22
24
|
*
|
|
23
25
|
* iOS 17+ real device environment will be via "mobile:setSimulatedLocation" as
|
|
24
26
|
* setting simulated location for XCTest session.
|
|
25
27
|
*
|
|
26
|
-
* @param
|
|
27
|
-
* @this {XCUITestDriver}
|
|
28
|
+
* @param location - Location with latitude and longitude
|
|
28
29
|
*/
|
|
29
|
-
export function setGeoLocation(this:
|
|
30
|
+
export declare function setGeoLocation(this: XCUITestDriver, location: Partial<Location>): Promise<Location>;
|
|
30
31
|
/**
|
|
31
32
|
* Reset the location service on real device.
|
|
32
33
|
*
|
|
33
34
|
* @throws {Error} If the device is simulator and iOS version is below 17,
|
|
34
35
|
* or 'resetLocation' raises an error.
|
|
35
|
-
* @this {XCUITestDriver}
|
|
36
36
|
*/
|
|
37
|
-
export function mobileResetLocationService(this:
|
|
38
|
-
export type XCUITestDriver = import("../driver").XCUITestDriver;
|
|
39
|
-
export type WDALocationInfo = import("./types").WDALocationInfo;
|
|
40
|
-
export type Location = import("@appium/types").Location;
|
|
37
|
+
export declare function mobileResetLocationService(this: XCUITestDriver): Promise<void>;
|
|
41
38
|
//# sourceMappingURL=location.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"location.d.ts","sourceRoot":"","sources":["../../../lib/commands/location.
|
|
1
|
+
{"version":3,"file":"location.d.ts","sourceRoot":"","sources":["../../../lib/commands/location.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,EAAC,oBAAoB,EAAkB,MAAM,SAAS,CAAC;AAGnE;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAkCxF;AAED;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,cAAc,EACpB,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,GAC1B,OAAO,CAAC,QAAQ,CAAC,CA6BnB;AAED;;;;;GAKG;AACH,wBAAsB,0BAA0B,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAsBpF"}
|
|
@@ -21,10 +21,9 @@ const utils_1 = require("../utils");
|
|
|
21
21
|
* "mobile:getSimulatedLocation" if the simulated location has been previously set
|
|
22
22
|
* "mobile:setSimulatedLocation" already.
|
|
23
23
|
*
|
|
24
|
-
* @returns
|
|
24
|
+
* @returns Location with altitude
|
|
25
25
|
* @throws {Error} If the device under test returns an error message.
|
|
26
26
|
* i.e.: tvOS returns unsupported error
|
|
27
|
-
* @this {XCUITestDriver}
|
|
28
27
|
*/
|
|
29
28
|
async function getGeoLocation() {
|
|
30
29
|
// Currently we proxy the setGeoLocation to mobile:setSimulatedLocation for iOS 17+.
|
|
@@ -43,7 +42,7 @@ async function getGeoLocation() {
|
|
|
43
42
|
// '/wda/device/location' returns current device location information,
|
|
44
43
|
// but '/wda/simulatedLocation' returns `null` values until the WDA process
|
|
45
44
|
// sets a simulated location. After setting the value, both returns the same values.
|
|
46
|
-
const { authorizationStatus, latitude, longitude, altitude } =
|
|
45
|
+
const { authorizationStatus, latitude, longitude, altitude } = await this.proxyCommand('/wda/device/location', 'GET');
|
|
47
46
|
// '3' is 'Always' in the privacy
|
|
48
47
|
// https://developer.apple.com/documentation/corelocation/clauthorizationstatus
|
|
49
48
|
if (authorizationStatus !== enum_1.AuthorizationStatus.authorizedAlways) {
|
|
@@ -61,17 +60,16 @@ async function getGeoLocation() {
|
|
|
61
60
|
* iOS 17+ real device environment will be via "mobile:setSimulatedLocation" as
|
|
62
61
|
* setting simulated location for XCTest session.
|
|
63
62
|
*
|
|
64
|
-
* @param
|
|
65
|
-
* @this {XCUITestDriver}
|
|
63
|
+
* @param location - Location with latitude and longitude
|
|
66
64
|
*/
|
|
67
65
|
async function setGeoLocation(location) {
|
|
68
|
-
|
|
66
|
+
const { latitude, longitude } = location;
|
|
69
67
|
if (!support_1.util.hasValue(latitude) || !support_1.util.hasValue(longitude)) {
|
|
70
68
|
throw new driver_1.errors.InvalidArgumentError(`Both latitude and longitude should be set`);
|
|
71
69
|
}
|
|
72
70
|
if (this.isSimulator()) {
|
|
73
|
-
await
|
|
74
|
-
return
|
|
71
|
+
await this.device.setGeolocation(`${latitude}`, `${longitude}`);
|
|
72
|
+
return { latitude, longitude, altitude: 0 };
|
|
75
73
|
}
|
|
76
74
|
if ((0, utils_1.isIos17OrNewer)(this.opts)) {
|
|
77
75
|
this.log.info(`Proxying to mobile:setSimulatedLocation method for iOS 17+`);
|
|
@@ -89,14 +87,13 @@ async function setGeoLocation(location) {
|
|
|
89
87
|
service.close();
|
|
90
88
|
}
|
|
91
89
|
}
|
|
92
|
-
return
|
|
90
|
+
return { latitude, longitude, altitude: 0 };
|
|
93
91
|
}
|
|
94
92
|
/**
|
|
95
93
|
* Reset the location service on real device.
|
|
96
94
|
*
|
|
97
95
|
* @throws {Error} If the device is simulator and iOS version is below 17,
|
|
98
96
|
* or 'resetLocation' raises an error.
|
|
99
|
-
* @this {XCUITestDriver}
|
|
100
97
|
*/
|
|
101
98
|
async function mobileResetLocationService() {
|
|
102
99
|
if ((0, utils_1.isIos17OrNewer)(this.opts)) {
|
|
@@ -119,9 +116,4 @@ async function mobileResetLocationService() {
|
|
|
119
116
|
service.close();
|
|
120
117
|
}
|
|
121
118
|
}
|
|
122
|
-
/**
|
|
123
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
124
|
-
* @typedef {import('./types').WDALocationInfo} WDALocationInfo
|
|
125
|
-
* @typedef {import('@appium/types').Location} Location
|
|
126
|
-
*/
|
|
127
119
|
//# sourceMappingURL=location.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"location.js","sourceRoot":"","sources":["../../../lib/commands/location.
|
|
1
|
+
{"version":3,"file":"location.js","sourceRoot":"","sources":["../../../lib/commands/location.ts"],"names":[],"mappings":";;AA2BA,wCAkCC;AAUD,wCAgCC;AAQD,gEAsBC;AArID,yDAA2C;AAC3C,0CAAqC;AACrC,4CAAoC;AACpC,iCAA2C;AAC3C,oCAA0C;AAM1C;;;;;;;;;;;;;;;;GAgBG;AACI,KAAK,UAAU,cAAc;IAClC,oFAAoF;IACpF,mFAAmF;IACnF,IAAI,IAAA,sBAAc,EAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9B,MAAM,EAAC,QAAQ,EAAE,SAAS,EAAC,GAAG,MAAM,IAAI,CAAC,0BAA0B,EAAE,CAAC;QACtE,IAAI,QAAQ,IAAI,SAAS,EAAE,CAAC;YAC1B,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,yFAAyF;gBACtG,qEAAqE,CAAC,CAAC;YACzE,OAAO,EAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,EAAC,CAAC;QAC5C,CAAC;QAED,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,oGAAoG,CAAC,CAAC;IACtH,CAAC;IAED,sFAAsF;IACtF,4FAA4F;IAC5F,sEAAsE;IACtE,2EAA2E;IAC3E,oFAAoF;IACpF,MAAM,EAAC,mBAAmB,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAC,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,sBAAsB,EAAE,KAAK,CAAoB,CAAC;IAEvI,iCAAiC;IACjC,+EAA+E;IAC/E,IAAI,mBAAmB,KAAK,0BAAmB,CAAC,gBAAgB,EAAE,CAAC;QACjE,MAAM,IAAI,CAAC,GAAG,CAAC,kBAAkB,CAC/B,uDAAuD;YACrD,uEAAuE;YACvE,2EAA2E;YAC3E,qFAAqF;YACrF,gCAAgC,CACnC,CAAC;IACJ,CAAC;IAED,OAAO,EAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ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