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
|
@@ -3,245 +3,261 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.active = active;
|
|
7
|
+
exports.touchId = touchId;
|
|
8
|
+
exports.toggleEnrollTouchId = toggleEnrollTouchId;
|
|
9
|
+
exports.getWindowSize = getWindowSize;
|
|
10
|
+
exports.getDeviceTime = getDeviceTime;
|
|
11
|
+
exports.mobileGetDeviceTime = mobileGetDeviceTime;
|
|
12
|
+
exports.getWindowRect = getWindowRect;
|
|
13
|
+
exports.removeApp = removeApp;
|
|
14
|
+
exports.launchApp = launchApp;
|
|
15
|
+
exports.closeApp = closeApp;
|
|
16
|
+
exports.setUrl = setUrl;
|
|
17
|
+
exports.getViewportRect = getViewportRect;
|
|
18
|
+
exports.getScreenInfo = getScreenInfo;
|
|
19
|
+
exports.getStatusBarHeight = getStatusBarHeight;
|
|
20
|
+
exports.getDevicePixelRatio = getDevicePixelRatio;
|
|
21
|
+
exports.mobilePressButton = mobilePressButton;
|
|
22
|
+
exports.mobileSiriCommand = mobileSiriCommand;
|
|
6
23
|
const lodash_1 = __importDefault(require("lodash"));
|
|
7
24
|
const driver_1 = require("appium/driver");
|
|
8
25
|
const moment_timezone_1 = __importDefault(require("moment-timezone"));
|
|
9
26
|
const appium_ios_device_1 = require("appium-ios-device");
|
|
10
27
|
const teen_process_1 = require("teen_process");
|
|
11
28
|
const MOMENT_FORMAT_ISO8601 = 'YYYY-MM-DDTHH:mm:ssZ';
|
|
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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
return stdout;
|
|
70
|
-
}
|
|
71
|
-
// @ts-expect-error This internal prop of moment is evidently a private API
|
|
72
|
-
return parsedTimestamp.utcOffset(parsedTimestamp._tzm || 0).format(format);
|
|
73
|
-
}
|
|
74
|
-
const { timestamp, utcOffset, timeZone } = await appium_ios_device_1.utilities.getDeviceTime(this.opts.udid);
|
|
75
|
-
this.log.debug(`timestamp: ${timestamp}, utcOffset: ${utcOffset}, timeZone: ${timeZone}`);
|
|
76
|
-
const utc = moment_timezone_1.default.unix(timestamp).utc();
|
|
77
|
-
// at some point of time Apple started to return timestamps
|
|
78
|
-
// in utcOffset instead of actual UTC offsets
|
|
79
|
-
if (Math.abs(utcOffset) <= 12 * 60) {
|
|
80
|
-
return utc.utcOffset(utcOffset).format(format);
|
|
81
|
-
}
|
|
82
|
-
// timeZone could either be a time zone name or
|
|
83
|
-
// an UTC offset in seconds
|
|
84
|
-
if (lodash_1.default.includes(timeZone, '/')) {
|
|
85
|
-
return utc.tz(timeZone).format(format);
|
|
86
|
-
}
|
|
87
|
-
if (Math.abs(timeZone) <= 12 * 60 * 60) {
|
|
88
|
-
return utc.utcOffset(timeZone / 60).format(format);
|
|
89
|
-
}
|
|
90
|
-
this.log.warn('Did not know how to apply the UTC offset. Returning the timestamp without it');
|
|
91
|
-
return utc.format(format);
|
|
92
|
-
},
|
|
93
|
-
/**
|
|
94
|
-
* Retrieves the current device time
|
|
95
|
-
*
|
|
96
|
-
* @param {string} format - See {@linkcode getDeviceTime.format}
|
|
97
|
-
* @returns {Promise<string>} Formatted datetime string or the raw command output if formatting fails
|
|
98
|
-
* @this {XCUITestDriver}
|
|
99
|
-
*/
|
|
100
|
-
async mobileGetDeviceTime(format = MOMENT_FORMAT_ISO8601) {
|
|
101
|
-
return await this.getDeviceTime(format);
|
|
102
|
-
},
|
|
103
|
-
/**
|
|
104
|
-
* For W3C
|
|
105
|
-
* @this {XCUITestDriver}
|
|
106
|
-
* @return {Promise<import('@appium/types').Rect>}
|
|
107
|
-
*/
|
|
108
|
-
async getWindowRect() {
|
|
109
|
-
if (this.isWebContext()) {
|
|
110
|
-
const script = 'return {' +
|
|
111
|
-
'x: window.screenX || 0,' +
|
|
112
|
-
'y: window.screenY || 0,' +
|
|
113
|
-
'width: window.innerWidth,' +
|
|
114
|
-
'height: window.innerHeight' +
|
|
115
|
-
'}';
|
|
116
|
-
return await this.executeAtom('execute_script', [script]);
|
|
117
|
-
}
|
|
118
|
-
return /** @type {import('@appium/types').Rect} */ (await this.proxyCommand('/window/rect', 'GET'));
|
|
119
|
-
},
|
|
120
|
-
/**
|
|
121
|
-
* @this {XCUITestDriver}
|
|
122
|
-
*/
|
|
123
|
-
async removeApp(bundleId) {
|
|
124
|
-
return await this.mobileRemoveApp(bundleId);
|
|
125
|
-
},
|
|
126
|
-
/**
|
|
127
|
-
* @this {XCUITestDriver}
|
|
128
|
-
*/
|
|
129
|
-
async launchApp() {
|
|
130
|
-
throw new Error(`The launchApp API has been deprecated and is not supported anymore. ` +
|
|
131
|
-
`Consider using corresponding 'mobile:' extensions to manage the state of the app under test.`);
|
|
132
|
-
},
|
|
133
|
-
/**
|
|
134
|
-
* @this {XCUITestDriver}
|
|
135
|
-
*/
|
|
136
|
-
async closeApp() {
|
|
137
|
-
throw new Error(`The closeApp API has been deprecated and is not supported anymore. ` +
|
|
138
|
-
`Consider using corresponding 'mobile:' extensions to manage the state of the app under test.`);
|
|
139
|
-
},
|
|
140
|
-
/**
|
|
141
|
-
* @this {XCUITestDriver}
|
|
142
|
-
*/
|
|
143
|
-
async setUrl(url) {
|
|
144
|
-
this.log.debug(`Attempting to set url '${url}'`);
|
|
145
|
-
if (this.isWebContext()) {
|
|
146
|
-
this.setCurrentUrl(url);
|
|
147
|
-
// make sure to clear out any leftover web frames
|
|
148
|
-
this.curWebFrames = [];
|
|
149
|
-
await ( /** @type {import('appium-remote-debugger').RemoteDebugger} */(this.remote)).navToUrl(url);
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
if (this.isRealDevice()) {
|
|
153
|
-
await this.proxyCommand('/url', 'POST', { url });
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
await /** @type {import('../driver').Simulator} */ (this.device).simctl.openUrl(url);
|
|
157
|
-
}
|
|
158
|
-
},
|
|
159
|
-
/**
|
|
160
|
-
* Retrieves the viewport dimensions.
|
|
161
|
-
*
|
|
162
|
-
* The viewport is the device's screen size with status bar size subtracted if the latter is present/visible.
|
|
163
|
-
* @returns {Promise<import('./types').Viewport>}
|
|
164
|
-
* @this {XCUITestDriver}
|
|
165
|
-
*/
|
|
166
|
-
async getViewportRect() {
|
|
167
|
-
const scale = await this.getDevicePixelRatio();
|
|
168
|
-
// status bar height comes in unscaled, so scale it
|
|
169
|
-
const statusBarHeight = Math.trunc((await this.getStatusBarHeight()) * scale);
|
|
170
|
-
const windowSize = await this.getWindowRect();
|
|
171
|
-
// ios returns coordinates/dimensions in logical pixels, not device pixels,
|
|
172
|
-
// so scale up to device pixels. status bar height is already scaled.
|
|
173
|
-
return {
|
|
174
|
-
left: 0,
|
|
175
|
-
top: statusBarHeight,
|
|
176
|
-
width: Math.trunc(windowSize.width * scale),
|
|
177
|
-
height: Math.trunc(windowSize.height * scale) - statusBarHeight,
|
|
178
|
-
};
|
|
179
|
-
},
|
|
180
|
-
/**
|
|
181
|
-
* Get information about the screen.
|
|
182
|
-
*
|
|
183
|
-
* @privateRemarks memoized in constructor
|
|
184
|
-
* @this {XCUITestDriver}
|
|
185
|
-
* @returns {Promise<ScreenInfo>}
|
|
186
|
-
*/
|
|
187
|
-
async getScreenInfo() {
|
|
188
|
-
return /** @type {ScreenInfo} */ (await this.proxyCommand('/wda/screen', 'GET'));
|
|
189
|
-
},
|
|
190
|
-
/**
|
|
191
|
-
* @this {XCUITestDriver}
|
|
192
|
-
*/
|
|
193
|
-
async getStatusBarHeight() {
|
|
194
|
-
const { statusBarSize } = await this.getScreenInfo();
|
|
195
|
-
return statusBarSize.height;
|
|
196
|
-
},
|
|
197
|
-
/**
|
|
198
|
-
* memoized in constructor
|
|
199
|
-
* @this {XCUITestDriver}
|
|
200
|
-
*/
|
|
201
|
-
async getDevicePixelRatio() {
|
|
202
|
-
const { scale } = await this.getScreenInfo();
|
|
203
|
-
return scale;
|
|
204
|
-
},
|
|
205
|
-
/**
|
|
206
|
-
* Emulates press action on the given physical device button.
|
|
207
|
-
*
|
|
208
|
-
* This executes different methods based on the platform:
|
|
209
|
-
*
|
|
210
|
-
* - iOS: [`pressButton:`](https://developer.apple.com/documentation/xctest/xcuidevice/1619052-pressbutton)
|
|
211
|
-
* - tvOS: [`pressButton:`](https://developer.apple.com/documentation/xctest/xcuiremote/1627475-pressbutton) or [`pressButton:forDuration:`](https://developer.apple.com/documentation/xctest/xcuiremote/1627476-pressbutton)
|
|
212
|
-
*
|
|
213
|
-
* Use {@linkcode mobilePerformIoHidEvent} to call a more universal API to perform a button press with duration on any supported device.
|
|
214
|
-
*
|
|
215
|
-
* @param {import('./types').ButtonName} name - The name of the button to be pressed.
|
|
216
|
-
* @param {number} [durationSeconds] - The duration of the button press in seconds (float).
|
|
217
|
-
* @this {XCUITestDriver}
|
|
218
|
-
*/
|
|
219
|
-
async mobilePressButton(name, durationSeconds) {
|
|
220
|
-
if (!name) {
|
|
221
|
-
throw new driver_1.errors.InvalidArgumentError('Button name is mandatory');
|
|
222
|
-
}
|
|
223
|
-
if (!lodash_1.default.isNil(durationSeconds) && !lodash_1.default.isNumber(durationSeconds)) {
|
|
224
|
-
throw new driver_1.errors.InvalidArgumentError('durationSeconds should be a number');
|
|
225
|
-
}
|
|
226
|
-
return await this.proxyCommand('/wda/pressButton', 'POST', { name, duration: durationSeconds });
|
|
227
|
-
},
|
|
228
|
-
/**
|
|
229
|
-
* Process a string as speech and send it to Siri.
|
|
230
|
-
*
|
|
231
|
-
* Presents the Siri UI, if it is not currently active, and accepts a string which is then processed as if it were recognized speech. See [the documentation of `activateWithVoiceRecognitionText`](https://developer.apple.com/documentation/xctest/xcuisiriservice/2852140-activatewithvoicerecognitiontext?language=objc) for more details.
|
|
232
|
-
|
|
233
|
-
* @param {string} text - Text to be sent to Siri
|
|
234
|
-
* @returns {Promise<void>}
|
|
235
|
-
* @this {XCUITestDriver}
|
|
236
|
-
*/
|
|
237
|
-
async mobileSiriCommand(text) {
|
|
238
|
-
if (!text) {
|
|
239
|
-
throw new driver_1.errors.InvalidArgumentError('"text" argument is mandatory');
|
|
29
|
+
/**
|
|
30
|
+
* @this {XCUITestDriver}
|
|
31
|
+
*/
|
|
32
|
+
async function active() {
|
|
33
|
+
if (this.isWebContext()) {
|
|
34
|
+
return this.cacheWebElements(await this.executeAtom('active_element', []));
|
|
35
|
+
}
|
|
36
|
+
return await this.proxyCommand(`/element/active`, 'GET');
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Trigger a touch/fingerprint match or match failure
|
|
40
|
+
*
|
|
41
|
+
* @param {boolean} match - whether the match should be a success or failure
|
|
42
|
+
* @this {XCUITestDriver}
|
|
43
|
+
*/
|
|
44
|
+
async function touchId(match = true) {
|
|
45
|
+
await this.mobileSendBiometricMatch('touchId', match);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Toggle whether the device is enrolled in the touch ID program
|
|
49
|
+
*
|
|
50
|
+
* @param {boolean} isEnabled - whether to enable or disable the touch ID program
|
|
51
|
+
*
|
|
52
|
+
* @this {XCUITestDriver}
|
|
53
|
+
*/
|
|
54
|
+
async function toggleEnrollTouchId(isEnabled = true) {
|
|
55
|
+
await this.mobileEnrollBiometric(isEnabled);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Get the window size
|
|
59
|
+
* @this {XCUITestDriver}
|
|
60
|
+
* @returns {Promise<import('@appium/types').Size>}
|
|
61
|
+
*/
|
|
62
|
+
async function getWindowSize() {
|
|
63
|
+
const { width, height } = await this.getWindowRect();
|
|
64
|
+
return { width, height };
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Retrieves the actual device time.
|
|
68
|
+
*
|
|
69
|
+
* @param {string} format - The format specifier string. Read the [MomentJS documentation](https://momentjs.com/docs/) to get the full list of supported datetime format specifiers. The default format is `YYYY-MM-DDTHH:mm:ssZ`, which complies to ISO-8601.
|
|
70
|
+
* @returns {Promise<string>} Formatted datetime string or the raw command output (if formatting fails)
|
|
71
|
+
* @this {XCUITestDriver}
|
|
72
|
+
*/
|
|
73
|
+
async function getDeviceTime(format = MOMENT_FORMAT_ISO8601) {
|
|
74
|
+
this.log.info('Attempting to capture iOS device date and time');
|
|
75
|
+
if (!this.isRealDevice()) {
|
|
76
|
+
this.log.info('On simulator. Assuming device time is the same as host time');
|
|
77
|
+
const cmd = 'date';
|
|
78
|
+
const args = ['+%Y-%m-%dT%H:%M:%S%z'];
|
|
79
|
+
const inputFormat = 'YYYY-MM-DDTHH:mm:ssZZ';
|
|
80
|
+
const stdout = (await (0, teen_process_1.exec)(cmd, args)).stdout.trim();
|
|
81
|
+
this.log.debug(`Got the following output out of '${cmd} ${args.join(' ')}': ${stdout}`);
|
|
82
|
+
const parsedTimestamp = moment_timezone_1.default.utc(stdout, inputFormat);
|
|
83
|
+
if (!parsedTimestamp.isValid()) {
|
|
84
|
+
this.log.warn(`Cannot parse the timestamp '${stdout}' returned by '${cmd}' command. Returning it as is`);
|
|
85
|
+
return stdout;
|
|
240
86
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
}
|
|
244
|
-
|
|
87
|
+
// @ts-expect-error This internal prop of moment is evidently a private API
|
|
88
|
+
return parsedTimestamp.utcOffset(parsedTimestamp._tzm || 0).format(format);
|
|
89
|
+
}
|
|
90
|
+
const { timestamp, utcOffset, timeZone } = await appium_ios_device_1.utilities.getDeviceTime(this.opts.udid);
|
|
91
|
+
this.log.debug(`timestamp: ${timestamp}, utcOffset: ${utcOffset}, timeZone: ${timeZone}`);
|
|
92
|
+
const utc = moment_timezone_1.default.unix(timestamp).utc();
|
|
93
|
+
// at some point of time Apple started to return timestamps
|
|
94
|
+
// in utcOffset instead of actual UTC offsets
|
|
95
|
+
if (Math.abs(utcOffset) <= 12 * 60) {
|
|
96
|
+
return utc.utcOffset(utcOffset).format(format);
|
|
97
|
+
}
|
|
98
|
+
// timeZone could either be a time zone name or
|
|
99
|
+
// an UTC offset in seconds
|
|
100
|
+
if (lodash_1.default.includes(timeZone, '/')) {
|
|
101
|
+
return utc.tz(timeZone).format(format);
|
|
102
|
+
}
|
|
103
|
+
if (Math.abs(timeZone) <= 12 * 60 * 60) {
|
|
104
|
+
return utc.utcOffset(timeZone / 60).format(format);
|
|
105
|
+
}
|
|
106
|
+
this.log.warn('Did not know how to apply the UTC offset. Returning the timestamp without it');
|
|
107
|
+
return utc.format(format);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Retrieves the current device time
|
|
111
|
+
*
|
|
112
|
+
* @param {string} format - See {@linkcode getDeviceTime.format}
|
|
113
|
+
* @returns {Promise<string>} Formatted datetime string or the raw command output if formatting fails
|
|
114
|
+
* @this {XCUITestDriver}
|
|
115
|
+
*/
|
|
116
|
+
async function mobileGetDeviceTime(format = MOMENT_FORMAT_ISO8601) {
|
|
117
|
+
return await this.getDeviceTime(format);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* For W3C
|
|
121
|
+
* @this {XCUITestDriver}
|
|
122
|
+
* @return {Promise<import('@appium/types').Rect>}
|
|
123
|
+
*/
|
|
124
|
+
async function getWindowRect() {
|
|
125
|
+
if (this.isWebContext()) {
|
|
126
|
+
const script = 'return {' +
|
|
127
|
+
'x: window.screenX || 0,' +
|
|
128
|
+
'y: window.screenY || 0,' +
|
|
129
|
+
'width: window.innerWidth,' +
|
|
130
|
+
'height: window.innerHeight' +
|
|
131
|
+
'}';
|
|
132
|
+
return await this.executeAtom('execute_script', [script]);
|
|
133
|
+
}
|
|
134
|
+
return /** @type {import('@appium/types').Rect} */ (await this.proxyCommand('/window/rect', 'GET'));
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* @this {XCUITestDriver}
|
|
138
|
+
*/
|
|
139
|
+
async function removeApp(bundleId) {
|
|
140
|
+
return await this.mobileRemoveApp(bundleId);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* @this {XCUITestDriver}
|
|
144
|
+
*/
|
|
145
|
+
async function launchApp() {
|
|
146
|
+
throw new Error(`The launchApp API has been deprecated and is not supported anymore. ` +
|
|
147
|
+
`Consider using corresponding 'mobile:' extensions to manage the state of the app under test.`);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* @this {XCUITestDriver}
|
|
151
|
+
*/
|
|
152
|
+
async function closeApp() {
|
|
153
|
+
throw new Error(`The closeApp API has been deprecated and is not supported anymore. ` +
|
|
154
|
+
`Consider using corresponding 'mobile:' extensions to manage the state of the app under test.`);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* @this {XCUITestDriver}
|
|
158
|
+
* @param {string} url
|
|
159
|
+
* @returns {Promise<void>}
|
|
160
|
+
*/
|
|
161
|
+
async function setUrl(url) {
|
|
162
|
+
this.log.debug(`Attempting to set url '${url}'`);
|
|
163
|
+
if (this.isWebContext()) {
|
|
164
|
+
this.setCurrentUrl(url);
|
|
165
|
+
// make sure to clear out any leftover web frames
|
|
166
|
+
this.curWebFrames = [];
|
|
167
|
+
await ( /** @type {import('appium-remote-debugger').RemoteDebugger} */(this.remote)).navToUrl(url);
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
if (this.isRealDevice()) {
|
|
171
|
+
await this.proxyCommand('/url', 'POST', { url });
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
await /** @type {import('../driver').Simulator} */ (this.device).simctl.openUrl(url);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Retrieves the viewport dimensions.
|
|
179
|
+
*
|
|
180
|
+
* The viewport is the device's screen size with status bar size subtracted if the latter is present/visible.
|
|
181
|
+
* @returns {Promise<import('./types').Viewport>}
|
|
182
|
+
* @this {XCUITestDriver}
|
|
183
|
+
*/
|
|
184
|
+
async function getViewportRect() {
|
|
185
|
+
const scale = await this.getDevicePixelRatio();
|
|
186
|
+
// status bar height comes in unscaled, so scale it
|
|
187
|
+
const statusBarHeight = Math.trunc((await this.getStatusBarHeight()) * scale);
|
|
188
|
+
const windowSize = await this.getWindowRect();
|
|
189
|
+
// ios returns coordinates/dimensions in logical pixels, not device pixels,
|
|
190
|
+
// so scale up to device pixels. status bar height is already scaled.
|
|
191
|
+
return {
|
|
192
|
+
left: 0,
|
|
193
|
+
top: statusBarHeight,
|
|
194
|
+
width: Math.trunc(windowSize.width * scale),
|
|
195
|
+
height: Math.trunc(windowSize.height * scale) - statusBarHeight,
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Get information about the screen.
|
|
200
|
+
*
|
|
201
|
+
* @privateRemarks memoized in constructor
|
|
202
|
+
* @this {XCUITestDriver}
|
|
203
|
+
* @returns {Promise<ScreenInfo>}
|
|
204
|
+
*/
|
|
205
|
+
async function getScreenInfo() {
|
|
206
|
+
return /** @type {ScreenInfo} */ (await this.proxyCommand('/wda/screen', 'GET'));
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* @this {XCUITestDriver}
|
|
210
|
+
*/
|
|
211
|
+
async function getStatusBarHeight() {
|
|
212
|
+
const { statusBarSize } = await this.getScreenInfo();
|
|
213
|
+
return statusBarSize.height;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* memoized in constructor
|
|
217
|
+
* @this {XCUITestDriver}
|
|
218
|
+
*/
|
|
219
|
+
async function getDevicePixelRatio() {
|
|
220
|
+
const { scale } = await this.getScreenInfo();
|
|
221
|
+
return scale;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Emulates press action on the given physical device button.
|
|
225
|
+
*
|
|
226
|
+
* This executes different methods based on the platform:
|
|
227
|
+
*
|
|
228
|
+
* - iOS: [`pressButton:`](https://developer.apple.com/documentation/xctest/xcuidevice/1619052-pressbutton)
|
|
229
|
+
* - tvOS: [`pressButton:`](https://developer.apple.com/documentation/xctest/xcuiremote/1627475-pressbutton) or [`pressButton:forDuration:`](https://developer.apple.com/documentation/xctest/xcuiremote/1627476-pressbutton)
|
|
230
|
+
*
|
|
231
|
+
* Use {@linkcode mobilePerformIoHidEvent} to call a more universal API to perform a button press with duration on any supported device.
|
|
232
|
+
*
|
|
233
|
+
* @param {import('./types').ButtonName} name - The name of the button to be pressed.
|
|
234
|
+
* @param {number} [durationSeconds] - The duration of the button press in seconds (float).
|
|
235
|
+
* @this {XCUITestDriver}
|
|
236
|
+
*/
|
|
237
|
+
async function mobilePressButton(name, durationSeconds) {
|
|
238
|
+
if (!name) {
|
|
239
|
+
throw new driver_1.errors.InvalidArgumentError('Button name is mandatory');
|
|
240
|
+
}
|
|
241
|
+
if (!lodash_1.default.isNil(durationSeconds) && !lodash_1.default.isNumber(durationSeconds)) {
|
|
242
|
+
throw new driver_1.errors.InvalidArgumentError('durationSeconds should be a number');
|
|
243
|
+
}
|
|
244
|
+
return await this.proxyCommand('/wda/pressButton', 'POST', { name, duration: durationSeconds });
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Process a string as speech and send it to Siri.
|
|
248
|
+
*
|
|
249
|
+
* Presents the Siri UI, if it is not currently active, and accepts a string which is then processed as if it were recognized speech. See [the documentation of `activateWithVoiceRecognitionText`](https://developer.apple.com/documentation/xctest/xcuisiriservice/2852140-activatewithvoicerecognitiontext?language=objc) for more details.
|
|
250
|
+
|
|
251
|
+
* @param {string} text - Text to be sent to Siri
|
|
252
|
+
* @returns {Promise<void>}
|
|
253
|
+
* @this {XCUITestDriver}
|
|
254
|
+
*/
|
|
255
|
+
async function mobileSiriCommand(text) {
|
|
256
|
+
if (!text) {
|
|
257
|
+
throw new driver_1.errors.InvalidArgumentError('"text" argument is mandatory');
|
|
258
|
+
}
|
|
259
|
+
await this.proxyCommand('/wda/siri/activate', 'POST', { text });
|
|
260
|
+
}
|
|
245
261
|
/**
|
|
246
262
|
* @typedef {Object} PressButtonOptions
|
|
247
263
|
* @property {string} name - The name of the button to be pressed.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"general.js","sourceRoot":"","sources":["../../../lib/commands/general.js"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"general.js","sourceRoot":"","sources":["../../../lib/commands/general.js"],"names":[],"mappings":";;;;;AAWA,wBAKC;AAQD,0BAEC;AAQD,kDAEC;AAOD,sCAGC;AASD,sCAsCC;AASD,kDAEC;AAOD,sCAcC;AAKD,8BAEC;AAKD,8BAKC;AAKD,4BAKC;AAOD,wBAgBC;AASD,0CAcC;AASD,sCAEC;AAKD,gDAGC;AAMD,kDAGC;AAgBD,8CAQC;AAWD,8CAKC;AA1QD,oDAAuB;AACvB,0CAAqC;AACrC,sEAAqC;AACrC,yDAA4C;AAC5C,+CAAkC;AAElC,MAAM,qBAAqB,GAAG,sBAAsB,CAAC;AAErD;;GAEG;AACI,KAAK,UAAU,MAAM;IAC1B,IAAI,IAAI,CAAC,YAAY,EAAE,EAAE,CAAC;QACxB,OAAO,IAAI,CAAC,gBAAgB,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC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|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} GeolocationInfo
|
|
3
|
+
* @property {number|null} latitude Measurement of distance north or south of the Equator, or
|
|
4
|
+
* `null` if {@linkcode XCUITestDriver.mobileSetSimulatedLocation} has not been called or {@linkcode
|
|
5
|
+
* resetSimulatedLocation} has been called.
|
|
6
|
+
* @property {number|null} longitude Measurement of distance east or west of the prime meridian, or
|
|
7
|
+
* `null` if {@linkcode XCUITestDriver.mobileSetSimulatedLocation} has not been called or {@linkcode
|
|
8
|
+
* resetSimulatedLocation} has been called.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Retrieves the simulated geolocation value.
|
|
12
|
+
* Only works since Xcode 14.3/iOS 16.4
|
|
13
|
+
*
|
|
14
|
+
* @returns {Promise<GeolocationInfo>}
|
|
15
|
+
* @throws {Error} If the device under test does not support gelolocation simulation.
|
|
16
|
+
* @since 4.18
|
|
17
|
+
* @this {XCUITestDriver}
|
|
18
|
+
*/
|
|
19
|
+
export function mobileGetSimulatedLocation(this: import("../driver").XCUITestDriver): Promise<GeolocationInfo>;
|
|
20
|
+
/**
|
|
21
|
+
* Sets simulated geolocation value.
|
|
22
|
+
* Only works since Xcode 14.3/iOS 16.4
|
|
23
|
+
*
|
|
24
|
+
* @param {number} latitude
|
|
25
|
+
* @param {number} longitude
|
|
26
|
+
* @returns {Promise<void>}
|
|
27
|
+
* @throws {Error} If the device under test does not support gelolocation simulation.
|
|
28
|
+
* @since 4.18
|
|
29
|
+
* @this {XCUITestDriver}
|
|
30
|
+
*/
|
|
31
|
+
export function mobileSetSimulatedLocation(this: import("../driver").XCUITestDriver, latitude: number, longitude: number): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Resets simulated geolocation value.
|
|
34
|
+
* Only works since Xcode 14.3/iOS 16.4.
|
|
35
|
+
* ! Do not forget to reset the simulated geolocation value after your automated test is finished.
|
|
36
|
+
* ! If the value is not reset explicitly then the simulated one will remain until the next device restart.
|
|
37
|
+
*
|
|
38
|
+
* @returns {Promise<void>}
|
|
39
|
+
* @throws {Error} If the device under test does not support gelolocation simulation.
|
|
40
|
+
* @since 4.18
|
|
41
|
+
* @this {XCUITestDriver}
|
|
42
|
+
*/
|
|
43
|
+
export function mobileResetSimulatedLocation(this: import("../driver").XCUITestDriver): Promise<void>;
|
|
2
44
|
export type GeolocationInfo = {
|
|
3
45
|
/**
|
|
4
46
|
* Measurement of distance north or south of the Equator, or
|
|
@@ -12,49 +54,4 @@ export type GeolocationInfo = {
|
|
|
12
54
|
longitude: number | null;
|
|
13
55
|
};
|
|
14
56
|
export type XCUITestDriver = import("../driver").XCUITestDriver;
|
|
15
|
-
export namespace commands {
|
|
16
|
-
/**
|
|
17
|
-
* @typedef {Object} GeolocationInfo
|
|
18
|
-
* @property {number|null} latitude Measurement of distance north or south of the Equator, or
|
|
19
|
-
* `null` if {@linkcode XCUITestDriver.mobileSetSimulatedLocation} has not been called or {@linkcode
|
|
20
|
-
* resetSimulatedLocation} has been called.
|
|
21
|
-
* @property {number|null} longitude Measurement of distance east or west of the prime meridian, or
|
|
22
|
-
* `null` if {@linkcode XCUITestDriver.mobileSetSimulatedLocation} has not been called or {@linkcode
|
|
23
|
-
* resetSimulatedLocation} has been called.
|
|
24
|
-
*/
|
|
25
|
-
/**
|
|
26
|
-
* Retrieves the simulated geolocation value.
|
|
27
|
-
* Only works since Xcode 14.3/iOS 16.4
|
|
28
|
-
*
|
|
29
|
-
* @returns {Promise<GeolocationInfo>}
|
|
30
|
-
* @throws {Error} If the device under test does not support gelolocation simulation.
|
|
31
|
-
* @since 4.18
|
|
32
|
-
* @this {XCUITestDriver}
|
|
33
|
-
*/
|
|
34
|
-
function mobileGetSimulatedLocation(this: import("../driver").XCUITestDriver): Promise<GeolocationInfo>;
|
|
35
|
-
/**
|
|
36
|
-
* Sets simulated geolocation value.
|
|
37
|
-
* Only works since Xcode 14.3/iOS 16.4
|
|
38
|
-
*
|
|
39
|
-
* @param {number} latitude
|
|
40
|
-
* @param {number} longitude
|
|
41
|
-
* @returns {Promise<void>}
|
|
42
|
-
* @throws {Error} If the device under test does not support gelolocation simulation.
|
|
43
|
-
* @since 4.18
|
|
44
|
-
* @this {XCUITestDriver}
|
|
45
|
-
*/
|
|
46
|
-
function mobileSetSimulatedLocation(this: import("../driver").XCUITestDriver, latitude: number, longitude: number): Promise<void>;
|
|
47
|
-
/**
|
|
48
|
-
* Resets simulated geolocation value.
|
|
49
|
-
* Only works since Xcode 14.3/iOS 16.4.
|
|
50
|
-
* ! Do not forget to reset the simulated geolocation value after your automated test is finished.
|
|
51
|
-
* ! If the value is not reset explicitly then the simulated one will remain until the next device restart.
|
|
52
|
-
*
|
|
53
|
-
* @returns {Promise<void>}
|
|
54
|
-
* @throws {Error} If the device under test does not support gelolocation simulation.
|
|
55
|
-
* @since 4.18
|
|
56
|
-
* @this {XCUITestDriver}
|
|
57
|
-
*/
|
|
58
|
-
function mobileResetSimulatedLocation(this: import("../driver").XCUITestDriver): Promise<void>;
|
|
59
|
-
}
|
|
60
57
|
//# sourceMappingURL=geolocation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geolocation.d.ts","sourceRoot":"","sources":["../../../lib/commands/geolocation.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"geolocation.d.ts","sourceRoot":"","sources":["../../../lib/commands/geolocation.js"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;;GAQG;AACH,sFALa,OAAO,CAAC,eAAe,CAAC,CAOpC;AAED;;;;;;;;;;GAUG;AACH,+FAPW,MAAM,aACN,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAOzB;AAED;;;;;;;;;;GAUG;AACH,wFALa,OAAO,CAAC,IAAI,CAAC,CAOzB;;;;;;cAjDa,MAAM,GAAC,IAAI;;;;;eAGX,MAAM,GAAC,IAAI;;6BAiDZ,OAAO,WAAW,EAAE,cAAc"}
|