@limrun/appium-xcuitest-driver 10.11.0-lim.4 → 10.14.6-lim.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 +94 -0
- package/build/lib/commands/active-app-info.d.ts +4 -3
- package/build/lib/commands/active-app-info.d.ts.map +1 -1
- package/build/lib/commands/active-app-info.js +2 -3
- package/build/lib/commands/active-app-info.js.map +1 -1
- package/build/lib/commands/alert.d.ts +26 -31
- package/build/lib/commands/alert.d.ts.map +1 -1
- package/build/lib/commands/alert.js +20 -29
- package/build/lib/commands/alert.js.map +1 -1
- package/build/lib/commands/app-management.d.ts +99 -76
- package/build/lib/commands/app-management.d.ts.map +1 -1
- package/build/lib/commands/app-management.js +83 -73
- package/build/lib/commands/app-management.js.map +1 -1
- package/build/lib/commands/app-strings.d.ts +6 -7
- package/build/lib/commands/app-strings.d.ts.map +1 -1
- package/build/lib/commands/app-strings.js +3 -8
- package/build/lib/commands/app-strings.js.map +1 -1
- package/build/lib/commands/appearance.d.ts +7 -9
- package/build/lib/commands/appearance.d.ts.map +1 -1
- package/build/lib/commands/appearance.js +13 -19
- package/build/lib/commands/appearance.js.map +1 -1
- package/build/lib/commands/audit.d.ts +5 -33
- package/build/lib/commands/audit.d.ts.map +1 -1
- package/build/lib/commands/audit.js +3 -16
- package/build/lib/commands/audit.js.map +1 -1
- package/build/lib/commands/battery.d.ts +4 -4
- package/build/lib/commands/battery.d.ts.map +1 -1
- package/build/lib/commands/battery.js +3 -7
- package/build/lib/commands/battery.js.map +1 -1
- package/build/lib/commands/biometric.d.ts +12 -14
- package/build/lib/commands/biometric.d.ts.map +1 -1
- package/build/lib/commands/biometric.js +10 -19
- package/build/lib/commands/biometric.js.map +1 -1
- package/build/lib/commands/certificate.d.ts +14 -19
- package/build/lib/commands/certificate.d.ts.map +1 -1
- package/build/lib/commands/certificate.js +24 -31
- package/build/lib/commands/certificate.js.map +1 -1
- package/build/lib/commands/clipboard.d.ts +9 -11
- package/build/lib/commands/clipboard.d.ts.map +1 -1
- package/build/lib/commands/clipboard.js +8 -13
- package/build/lib/commands/clipboard.js.map +1 -1
- package/build/lib/commands/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/content-size.d.ts +16 -19
- package/build/lib/commands/content-size.d.ts.map +1 -1
- package/build/lib/commands/content-size.js +14 -22
- package/build/lib/commands/content-size.js.map +1 -1
- package/build/lib/commands/context.d.ts +130 -161
- package/build/lib/commands/context.d.ts.map +1 -1
- package/build/lib/commands/context.js +123 -108
- package/build/lib/commands/context.js.map +1 -1
- package/build/lib/commands/device-info.d.ts +13 -0
- package/build/lib/commands/device-info.d.ts.map +1 -0
- package/build/lib/commands/device-info.js +20 -0
- package/build/lib/commands/device-info.js.map +1 -0
- package/build/lib/commands/element.d.ts +83 -67
- package/build/lib/commands/element.d.ts.map +1 -1
- package/build/lib/commands/element.js +111 -134
- package/build/lib/commands/element.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 +13 -29
- package/build/lib/commands/execute.js.map +1 -1
- package/build/lib/commands/file-movement.d.ts +31 -42
- package/build/lib/commands/file-movement.d.ts.map +1 -1
- package/build/lib/commands/file-movement.js +146 -205
- package/build/lib/commands/file-movement.js.map +1 -1
- package/build/lib/commands/find.d.ts +20 -12
- package/build/lib/commands/find.d.ts.map +1 -1
- package/build/lib/commands/find.js +27 -65
- package/build/lib/commands/find.js.map +1 -1
- package/build/lib/commands/general.d.ts +84 -80
- package/build/lib/commands/general.d.ts.map +1 -1
- package/build/lib/commands/general.js +67 -54
- package/build/lib/commands/general.js.map +1 -1
- package/build/lib/commands/geolocation.d.ts +16 -36
- package/build/lib/commands/geolocation.d.ts.map +1 -1
- package/build/lib/commands/geolocation.js +8 -25
- package/build/lib/commands/geolocation.js.map +1 -1
- package/build/lib/commands/gesture.d.ts +103 -119
- package/build/lib/commands/gesture.d.ts.map +1 -1
- package/build/lib/commands/gesture.js +98 -138
- package/build/lib/commands/gesture.js.map +1 -1
- package/build/lib/commands/increase-contrast.d.ts +10 -13
- package/build/lib/commands/increase-contrast.d.ts.map +1 -1
- package/build/lib/commands/increase-contrast.js +8 -16
- package/build/lib/commands/increase-contrast.js.map +1 -1
- package/build/lib/commands/iohid.d.ts +6 -1359
- package/build/lib/commands/iohid.d.ts.map +1 -1
- package/build/lib/commands/iohid.js +5 -10
- package/build/lib/commands/iohid.js.map +1 -1
- package/build/lib/commands/keyboard.d.ts +16 -13
- package/build/lib/commands/keyboard.d.ts.map +1 -1
- package/build/lib/commands/keyboard.js +14 -18
- package/build/lib/commands/keyboard.js.map +1 -1
- package/build/lib/commands/keychains.d.ts +2 -2
- package/build/lib/commands/keychains.d.ts.map +1 -1
- package/build/lib/commands/keychains.js +1 -4
- package/build/lib/commands/keychains.js.map +1 -1
- package/build/lib/commands/localization.d.ts +7 -6
- package/build/lib/commands/localization.d.ts.map +1 -1
- package/build/lib/commands/localization.js +7 -8
- package/build/lib/commands/localization.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/lock.d.ts +6 -10
- package/build/lib/commands/lock.d.ts.map +1 -1
- package/build/lib/commands/lock.js +3 -10
- package/build/lib/commands/lock.js.map +1 -1
- package/build/lib/commands/log.d.ts +42 -44
- package/build/lib/commands/log.d.ts.map +1 -1
- package/build/lib/commands/log.js +32 -53
- package/build/lib/commands/log.js.map +1 -1
- package/build/lib/commands/memory.d.ts +4 -5
- package/build/lib/commands/memory.d.ts.map +1 -1
- package/build/lib/commands/memory.js +3 -8
- package/build/lib/commands/memory.js.map +1 -1
- package/build/lib/commands/navigation.d.ts +14 -26
- package/build/lib/commands/navigation.d.ts.map +1 -1
- package/build/lib/commands/navigation.js +22 -32
- package/build/lib/commands/navigation.js.map +1 -1
- package/build/lib/commands/notifications.d.ts +10 -10
- package/build/lib/commands/notifications.d.ts.map +1 -1
- package/build/lib/commands/notifications.js +8 -12
- package/build/lib/commands/notifications.js.map +1 -1
- package/build/lib/commands/pasteboard.d.ts +9 -10
- package/build/lib/commands/pasteboard.d.ts.map +1 -1
- package/build/lib/commands/pasteboard.js +8 -13
- package/build/lib/commands/pasteboard.js.map +1 -1
- package/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/performance.d.ts +36 -55
- package/build/lib/commands/performance.d.ts.map +1 -1
- package/build/lib/commands/performance.js +93 -86
- package/build/lib/commands/performance.js.map +1 -1
- package/build/lib/commands/permissions.d.ts +15 -17
- package/build/lib/commands/permissions.d.ts.map +1 -1
- package/build/lib/commands/permissions.js +12 -18
- package/build/lib/commands/permissions.js.map +1 -1
- package/build/lib/commands/proxy-helper.d.ts +11 -11
- package/build/lib/commands/proxy-helper.d.ts.map +1 -1
- package/build/lib/commands/proxy-helper.js +15 -24
- package/build/lib/commands/proxy-helper.js.map +1 -1
- package/build/lib/commands/record-audio.d.ts +25 -52
- 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/recordscreen.d.ts +31 -62
- package/build/lib/commands/recordscreen.d.ts.map +1 -1
- package/build/lib/commands/recordscreen.js +29 -28
- package/build/lib/commands/recordscreen.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 +16 -16
- package/build/lib/commands/screenshots.js.map +1 -1
- package/build/lib/commands/simctl.d.ts +16 -22
- package/build/lib/commands/simctl.d.ts.map +1 -1
- package/build/lib/commands/simctl.js +13 -17
- package/build/lib/commands/simctl.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/timeouts.d.ts +25 -32
- package/build/lib/commands/timeouts.d.ts.map +1 -1
- package/build/lib/commands/timeouts.js +19 -15
- package/build/lib/commands/timeouts.js.map +1 -1
- package/build/lib/commands/types.d.ts +80 -0
- package/build/lib/commands/types.d.ts.map +1 -1
- package/build/lib/commands/web.d.ts +199 -202
- package/build/lib/commands/web.d.ts.map +1 -1
- package/build/lib/commands/web.js +216 -175
- package/build/lib/commands/web.js.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/commands/xctest.d.ts +37 -37
- package/build/lib/commands/xctest.d.ts.map +1 -1
- package/build/lib/commands/xctest.js +38 -50
- package/build/lib/commands/xctest.js.map +1 -1
- package/build/lib/desired-caps.js +1 -1
- package/build/lib/device/log/ios-simulator-log.d.ts.map +1 -1
- package/build/lib/device/log/ios-simulator-log.js +2 -0
- package/build/lib/device/log/ios-simulator-log.js.map +1 -1
- package/build/lib/device/simulator-management.d.ts.map +1 -1
- package/build/lib/device/simulator-management.js +0 -2
- package/build/lib/device/simulator-management.js.map +1 -1
- package/build/lib/doctor/optional-checks.d.ts +0 -9
- package/build/lib/doctor/optional-checks.d.ts.map +1 -1
- package/build/lib/doctor/optional-checks.js +1 -30
- package/build/lib/doctor/optional-checks.js.map +1 -1
- package/build/lib/driver.d.ts +6 -5
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/driver.js +16 -14
- 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 -9
- package/build/lib/execute-method-map.js.map +1 -1
- package/lib/commands/active-app-info.ts +15 -0
- package/lib/commands/alert.ts +98 -0
- package/lib/commands/app-management.ts +414 -0
- package/lib/commands/{app-strings.js → app-strings.ts} +10 -9
- package/lib/commands/appearance.ts +70 -0
- package/lib/commands/audit.ts +25 -0
- package/lib/commands/{battery.js → battery.ts} +10 -12
- package/lib/commands/biometric.ts +52 -0
- package/lib/commands/{certificate.js → certificate.ts} +55 -50
- package/lib/commands/clipboard.ts +37 -0
- package/lib/commands/{condition.js → condition.ts} +21 -77
- package/lib/commands/content-size.ts +67 -0
- package/lib/commands/{context.js → context.ts} +174 -146
- package/lib/commands/device-info.ts +24 -0
- package/lib/commands/element.ts +419 -0
- package/lib/commands/{execute.js → execute.ts} +42 -38
- package/lib/commands/{file-movement.js → file-movement.ts} +212 -235
- package/lib/commands/find.ts +277 -0
- package/lib/commands/{general.js → general.ts} +102 -77
- package/lib/commands/geolocation.ts +55 -0
- package/lib/commands/{gesture.js → gesture.ts} +225 -183
- package/lib/commands/increase-contrast.ts +49 -0
- package/lib/commands/{iohid.js → iohid.ts} +15 -13
- package/lib/commands/keyboard.ts +70 -0
- package/lib/commands/keychains.ts +16 -0
- package/lib/commands/{localization.js → localization.ts} +22 -12
- package/lib/commands/{location.js → location.ts} +19 -22
- package/lib/commands/lock.ts +43 -0
- package/lib/commands/{log.js → log.ts} +68 -68
- package/lib/commands/{memory.js → memory.ts} +9 -9
- package/lib/commands/{navigation.js → navigation.ts} +42 -39
- package/lib/commands/{notifications.js → notifications.ts} +22 -14
- package/lib/commands/pasteboard.ts +44 -0
- package/lib/commands/{pcap.js → pcap.ts} +28 -28
- package/lib/commands/{performance.js → performance.ts} +133 -114
- package/lib/commands/permissions.ts +90 -0
- package/lib/commands/{proxy-helper.js → proxy-helper.ts} +26 -26
- package/lib/commands/{record-audio.js → record-audio.ts} +35 -33
- package/lib/commands/{recordscreen.js → recordscreen.ts} +78 -50
- package/lib/commands/{screenshots.js → screenshots.ts} +27 -21
- package/lib/commands/simctl.ts +82 -0
- package/lib/commands/{source.js → source.ts} +23 -20
- package/lib/commands/timeouts.ts +95 -0
- package/lib/commands/types.ts +86 -0
- package/lib/commands/{web.js → web.ts} +314 -264
- package/lib/commands/{xctest-record-screen.js → xctest-record-screen.ts} +54 -71
- package/lib/commands/{xctest.js → xctest.ts} +78 -71
- package/lib/desired-caps.ts +1 -1
- package/lib/device/log/ios-simulator-log.ts +2 -0
- package/lib/device/simulator-management.ts +0 -2
- package/lib/doctor/optional-checks.ts +0 -33
- package/lib/driver.ts +19 -17
- package/lib/execute-method-map.ts +0 -9
- package/package.json +6 -6
- package/lib/commands/active-app-info.js +0 -12
- package/lib/commands/alert.js +0 -88
- package/lib/commands/app-management.js +0 -346
- package/lib/commands/appearance.js +0 -71
- package/lib/commands/audit.js +0 -31
- package/lib/commands/biometric.js +0 -52
- package/lib/commands/clipboard.js +0 -35
- package/lib/commands/content-size.js +0 -68
- package/lib/commands/deviceInfo.js +0 -27
- package/lib/commands/element.js +0 -423
- package/lib/commands/find.js +0 -205
- package/lib/commands/geolocation.js +0 -56
- package/lib/commands/increase-contrast.js +0 -50
- package/lib/commands/keyboard.js +0 -62
- package/lib/commands/keychains.js +0 -17
- package/lib/commands/lock.js +0 -46
- package/lib/commands/pasteboard.js +0 -43
- package/lib/commands/permissions.js +0 -85
- package/lib/commands/simctl.js +0 -71
- package/lib/commands/timeouts.js +0 -68
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import _ from 'lodash';
|
|
2
|
-
import {assertSimulator as _assertSimulator} from '../utils';
|
|
3
|
-
import { errors } from 'appium/driver';
|
|
4
|
-
|
|
5
|
-
const assertSimulator = (driver) => _assertSimulator.call(driver, 'Content size ui command');
|
|
6
|
-
|
|
7
|
-
const INCREASE_CONTRAST_CONFIG = [
|
|
8
|
-
'enabled',
|
|
9
|
-
'disabled',
|
|
10
|
-
];
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Sets the increase contrast configuration for the given simulator.
|
|
14
|
-
*
|
|
15
|
-
* @since Xcode 15 (but lower xcode could have this command)
|
|
16
|
-
* @param {IncreaseContrastAction} increaseContrast valid increase contrast configuration value.
|
|
17
|
-
* Acceptable value is 'enabled' or 'disabled' with Xcode 16.2.
|
|
18
|
-
* @throws {Error} if the current platform does not support content size appearance changes
|
|
19
|
-
* @this {XCUITestDriver}
|
|
20
|
-
*/
|
|
21
|
-
export async function mobileSetIncreaseContrast(increaseContrast) {
|
|
22
|
-
const simulator = assertSimulator(this);
|
|
23
|
-
|
|
24
|
-
if (!INCREASE_CONTRAST_CONFIG.includes(_.lowerCase(increaseContrast))) {
|
|
25
|
-
throw new errors.InvalidArgumentError(
|
|
26
|
-
`The 'increaseContrast' value is expected to be one of ${INCREASE_CONTRAST_CONFIG.join(',')}`
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
await simulator.setIncreaseContrast(increaseContrast);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Retrieves the current increase contrast configuration value from the given simulator.
|
|
35
|
-
*
|
|
36
|
-
* @since Xcode 15 (but lower xcode could have this command)
|
|
37
|
-
* @returns {Promise<IncreaseContrastResult>} the contrast configuration value.
|
|
38
|
-
* Possible return value is 'enabled', 'disabled',
|
|
39
|
-
* 'unsupported' or 'unknown' with Xcode 16.2.
|
|
40
|
-
* @this {XCUITestDriver}
|
|
41
|
-
*/
|
|
42
|
-
export async function mobileGetIncreaseContrast() {
|
|
43
|
-
return /** @type {IncreaseContrastResult} */ (await assertSimulator(this).getIncreaseContrast());
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
48
|
-
* @typedef {import('./types').IncreaseContrastAction} IncreaseContrastAction
|
|
49
|
-
* @typedef {import('./types').IncreaseContrastResult} IncreaseContrastResult
|
|
50
|
-
*/
|
package/lib/commands/keyboard.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import _ from 'lodash';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @this {XCUITestDriver}
|
|
5
|
-
* @deprecated
|
|
6
|
-
*/
|
|
7
|
-
export async function hideKeyboard(strategy, ...possibleKeys) {
|
|
8
|
-
// last parameter is the session id
|
|
9
|
-
const keyNames = _.compact(possibleKeys.slice(0, -1)).map((x) => `${x}`);
|
|
10
|
-
await this.mobileHideKeyboard(keyNames);
|
|
11
|
-
return true;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @this {XCUITestDriver}
|
|
16
|
-
* @param {string[]} keys
|
|
17
|
-
*/
|
|
18
|
-
export async function mobileHideKeyboard(keys = []) {
|
|
19
|
-
if (!keys.includes('done')) {
|
|
20
|
-
keys.push('done');
|
|
21
|
-
}
|
|
22
|
-
await this.proxyCommand('/wda/keyboard/dismiss', 'POST', {keyNames: keys});
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* @this {XCUITestDriver}
|
|
27
|
-
*/
|
|
28
|
-
export async function isKeyboardShown() {
|
|
29
|
-
try {
|
|
30
|
-
await this.findNativeElementOrElements('class name', 'XCUIElementTypeKeyboard', false);
|
|
31
|
-
return true;
|
|
32
|
-
} catch {
|
|
33
|
-
return false;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Send keys to the given element or to the application under test.
|
|
39
|
-
* This API is not supported on tvOS
|
|
40
|
-
*
|
|
41
|
-
* @since Xcode 15/iOS 17
|
|
42
|
-
* @this {import('../driver').XCUITestDriver}
|
|
43
|
-
* @param {(Key|string)[]} keys Array of keys to type.
|
|
44
|
-
* Each item could either be a string, that represents a key itself (see
|
|
45
|
-
* https://developer.apple.com/documentation/xctest/xcuielement/1500604-typekey?language=objc
|
|
46
|
-
* and https://developer.apple.com/documentation/xctest/xcuikeyboardkey?language=objc)
|
|
47
|
-
* or a dictionary, if the key should also be entered with modifiers.
|
|
48
|
-
* @param {string?} [elementId=null] uuid of the element to send keys to.
|
|
49
|
-
* If the element is not provided then the keys will be sent to the current application.
|
|
50
|
-
*/
|
|
51
|
-
export async function mobileKeys(keys, elementId = null) {
|
|
52
|
-
const url = `/wda/element/${elementId || 0}/keyboardInput`;
|
|
53
|
-
return await this.proxyCommand(url, 'POST', { keys });
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
58
|
-
*/
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* @typedef {import('./types').KeyboardKey} Key
|
|
62
|
-
*/
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import {assertSimulator as _assertSimulator} from '../utils';
|
|
2
|
-
|
|
3
|
-
const assertSimulator = (driver) => _assertSimulator.call(driver, 'Keychain modification');
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Clears keychains on a simulated device.
|
|
7
|
-
*
|
|
8
|
-
* @throws {Error} If current device is not a Simulator or there was an error
|
|
9
|
-
* while clearing keychains.
|
|
10
|
-
* @this {import('../driver').XCUITestDriver}
|
|
11
|
-
* @group Simulator Only
|
|
12
|
-
*/
|
|
13
|
-
export async function mobileClearKeychains() {
|
|
14
|
-
assertSimulator(this);
|
|
15
|
-
|
|
16
|
-
await /** @type {import('appium-ios-simulator').Simulator} */ (this.device).clearKeychains();
|
|
17
|
-
}
|
package/lib/commands/lock.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import B from 'bluebird';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Lock the device (and optionally unlock the device after a certain amount of time)
|
|
5
|
-
*
|
|
6
|
-
* @param {number|string} [seconds] - the number of seconds after which to unlock the device. Set to `0` or leave empty to require manual unlock (do not automatically unlock).
|
|
7
|
-
* @defaultValue 0
|
|
8
|
-
* @this {XCUITestDriver}
|
|
9
|
-
*/
|
|
10
|
-
export async function lock(seconds) {
|
|
11
|
-
await this.proxyCommand('/wda/lock', 'POST');
|
|
12
|
-
if (isNaN(Number(seconds))) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const floatSeconds = parseFloat(String(seconds));
|
|
17
|
-
if (floatSeconds <= 0) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
await B.delay(floatSeconds * 1000);
|
|
22
|
-
await this.proxyCommand('/wda/unlock', 'POST');
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Unlock the device
|
|
27
|
-
*
|
|
28
|
-
* @this {XCUITestDriver}
|
|
29
|
-
*/
|
|
30
|
-
export async function unlock() {
|
|
31
|
-
await this.proxyCommand('/wda/unlock', 'POST');
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Determine whether the device is locked
|
|
36
|
-
*
|
|
37
|
-
* @this {XCUITestDriver}
|
|
38
|
-
* @returns {Promise<boolean>} `true` if the device is locked, `false` otherwise
|
|
39
|
-
*/
|
|
40
|
-
export async function isLocked() {
|
|
41
|
-
return /** @type {boolean} */ (await this.proxyCommand('/wda/locked', 'GET'));
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
46
|
-
*/
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import _ from 'lodash';
|
|
2
|
-
import { assertSimulator } from '../utils';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Sets the Simulator's pasteboard content to the given value.
|
|
6
|
-
*
|
|
7
|
-
* Does not work for real devices.
|
|
8
|
-
* @param {string} content - The content to set
|
|
9
|
-
* @param {string} encoding - The content's encoding
|
|
10
|
-
* @group Simulator Only
|
|
11
|
-
* @returns {Promise<void>}
|
|
12
|
-
* @this {XCUITestDriver}
|
|
13
|
-
*/
|
|
14
|
-
export async function mobileSetPasteboard(content, encoding = 'utf8') {
|
|
15
|
-
assertSimulator.call(this, 'Setting pasteboard content');
|
|
16
|
-
if (!_.isString(content)) {
|
|
17
|
-
// can be empty string
|
|
18
|
-
throw new Error('Pasteboard content is mandatory to set');
|
|
19
|
-
}
|
|
20
|
-
return await /** @type {import('appium-ios-simulator').Simulator} */ (this.device).simctl.setPasteboard(
|
|
21
|
-
content, /** @type {BufferEncoding} */ (encoding)
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Gets the Simulator's pasteboard content.
|
|
27
|
-
*
|
|
28
|
-
* Does not work for real devices.
|
|
29
|
-
* @param {BufferEncoding} encoding - Expected encoding of returned string
|
|
30
|
-
* @group Simulator Only
|
|
31
|
-
* @this {XCUITestDriver}
|
|
32
|
-
* @returns {Promise<string>} The pasteboard content string
|
|
33
|
-
*/
|
|
34
|
-
export async function mobileGetPasteboard(encoding = 'utf8') {
|
|
35
|
-
assertSimulator.call(this, 'Getting pasteboard content');
|
|
36
|
-
return await /** @type {import('appium-ios-simulator').Simulator} */ (this.device).simctl.getPasteboard(
|
|
37
|
-
/** @type {BufferEncoding} */ (encoding)
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
43
|
-
*/
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import _ from 'lodash';
|
|
2
|
-
import {PermissionService} from './enum';
|
|
3
|
-
import {assertSimulator as _assertSimulator} from '../utils';
|
|
4
|
-
|
|
5
|
-
const assertSimulator = (driver) => _assertSimulator.call(driver, 'Permission-related operations');
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Resets the given permission for the active application under test.
|
|
9
|
-
* Works for both Simulator and real devices using Xcode SDK 11.4+
|
|
10
|
-
*
|
|
11
|
-
* @param {PermissionService|number} service - One of the available service names. This could also be an integer protected resource identifier; see [this list](https://developer.apple.com/documentation/xctest/xcuiprotectedresource?language=objc)
|
|
12
|
-
* @throws {Error} If permission reset fails on the device.
|
|
13
|
-
* @this {XCUITestDriver}
|
|
14
|
-
*/
|
|
15
|
-
export async function mobileResetPermission(service) {
|
|
16
|
-
if (!service) {
|
|
17
|
-
throw new Error(`The 'service' option is expected to be present`);
|
|
18
|
-
}
|
|
19
|
-
let resource;
|
|
20
|
-
if (_.isString(service)) {
|
|
21
|
-
resource = PermissionService[_.toLower(service)];
|
|
22
|
-
if (!resource) {
|
|
23
|
-
throw new Error(
|
|
24
|
-
`The 'service' value must be one of ` + `${JSON.stringify(_.keys(PermissionService))}`,
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
} else if (_.isInteger(service)) {
|
|
28
|
-
resource = service;
|
|
29
|
-
} else {
|
|
30
|
-
throw new Error(
|
|
31
|
-
`The 'service' value must be either a string or an integer. ` +
|
|
32
|
-
`'${service}' is passed instead`,
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
await this.proxyCommand('/wda/resetAppAuth', 'POST', {resource});
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Gets application permission state on a simulated device.
|
|
41
|
-
*
|
|
42
|
-
* **This method requires [WIX applesimutils](https://github.com/wix/AppleSimulatorUtils) to be installed on the Appium server host.**
|
|
43
|
-
*
|
|
44
|
-
* @param {string} bundleId - Bundle identifier of the target application
|
|
45
|
-
* @param {import('./enum').PermissionService} service - Service name
|
|
46
|
-
* @returns {Promise<import('./types').PermissionState>} Either 'yes', 'no', 'unset' or 'limited'
|
|
47
|
-
* @throws {Error} If permission getting fails or the device is not a Simulator.
|
|
48
|
-
* @this {XCUITestDriver}
|
|
49
|
-
* @group Simulator Only
|
|
50
|
-
*/
|
|
51
|
-
export async function mobileGetPermission(bundleId, service) {
|
|
52
|
-
if (!service) {
|
|
53
|
-
throw new Error(`The 'service' option is expected to be present`);
|
|
54
|
-
}
|
|
55
|
-
assertSimulator(this);
|
|
56
|
-
|
|
57
|
-
return /** @type {import('./types').PermissionState} */ (
|
|
58
|
-
await /** @type {import('appium-ios-simulator').Simulator} */ (this.device).getPermission(
|
|
59
|
-
bundleId, String(service)
|
|
60
|
-
)
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Set application permission state on Simulator.
|
|
66
|
-
*
|
|
67
|
-
* @param {Record<Partial<import('./types').AccessRule>, import('./types').PermissionState>} access - One or more access rules to set.
|
|
68
|
-
* @param {string} bundleId - Bundle identifier of the target application
|
|
69
|
-
* @since Xcode SDK 11.4
|
|
70
|
-
* @throws {Error} If permission setting fails or the device is not a Simulator.
|
|
71
|
-
* @group Simulator Only
|
|
72
|
-
* @this {XCUITestDriver}
|
|
73
|
-
*/
|
|
74
|
-
export async function mobileSetPermissions(access, bundleId) {
|
|
75
|
-
if (!_.isPlainObject(access)) {
|
|
76
|
-
throw new Error(`The 'access' option is expected to be a map`);
|
|
77
|
-
}
|
|
78
|
-
assertSimulator(this);
|
|
79
|
-
|
|
80
|
-
await /** @type {import('appium-ios-simulator').Simulator} */ (this.device).setPermissions(bundleId, access);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
85
|
-
*/
|
package/lib/commands/simctl.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { errors } from 'appium/driver';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* List of subcommands for `simctl` we provide as mobile simctl command.
|
|
5
|
-
* They accept 'device' target.
|
|
6
|
-
*/
|
|
7
|
-
const SUBCOMMANDS_HAS_DEVICE = [
|
|
8
|
-
'boot',
|
|
9
|
-
'get_app_container',
|
|
10
|
-
'getenv',
|
|
11
|
-
'icloud_sync',
|
|
12
|
-
'install',
|
|
13
|
-
'install_app_data',
|
|
14
|
-
'io',
|
|
15
|
-
'keychain',
|
|
16
|
-
'launch',
|
|
17
|
-
'location',
|
|
18
|
-
'logverbose',
|
|
19
|
-
'openurl',
|
|
20
|
-
'pbcopy',
|
|
21
|
-
'pbpaste',
|
|
22
|
-
'privacy',
|
|
23
|
-
'push',
|
|
24
|
-
'shutdown',
|
|
25
|
-
'spawn',
|
|
26
|
-
'status_bar',
|
|
27
|
-
'terminate',
|
|
28
|
-
'ui',
|
|
29
|
-
'uninstall'
|
|
30
|
-
];
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Run the given command with arguments as `xcrun simctl` subcommand.
|
|
34
|
-
* This method works behind the 'simctl' security flag.
|
|
35
|
-
* @this {XCUITestDriver}
|
|
36
|
-
* @param {string} command Subcommand to run with `xcrun simctl`
|
|
37
|
-
* @param {string[]} [args=[]] arguments for the subcommand. The arguments should be after <device> in the help.
|
|
38
|
-
* @param {number|undefined} timeout - The maximum number of milliseconds
|
|
39
|
-
* @returns {Promise<SimctlExecResponse>}
|
|
40
|
-
* @throws {Error} If the simctl subcommand command returns non-zero return code, or the given subcommand was invalid.
|
|
41
|
-
*/
|
|
42
|
-
export async function mobileSimctl(command, args = [], timeout = undefined) {
|
|
43
|
-
if (!this.isSimulator()) {
|
|
44
|
-
throw new errors.UnsupportedOperationError(`Only simulator is supported.`);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
if (!this.opts.udid) {
|
|
48
|
-
throw new errors.InvalidArgumentError(`Unknown device or simulator UDID: '${this.opts.udid}'`);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (!SUBCOMMANDS_HAS_DEVICE.includes(command)) {
|
|
52
|
-
throw new errors.InvalidArgumentError(`The given command '${command}' is not supported. ` +
|
|
53
|
-
`Available subcommands are ${SUBCOMMANDS_HAS_DEVICE.join(',')}`);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return await /** @type {import('appium-ios-simulator').Simulator} */ (this.device).simctl.exec(
|
|
57
|
-
command,
|
|
58
|
-
{args: [this.opts.udid, ...args], timeout}
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* @typedef {Object} SimctlExecResponse
|
|
64
|
-
* @property {string} stdout The output of standard out.
|
|
65
|
-
* @property {string} stderr The output of standard error.
|
|
66
|
-
* @property {number} code Return code.
|
|
67
|
-
*/
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
71
|
-
*/
|
package/lib/commands/timeouts.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @this {XCUITestDriver}
|
|
3
|
-
*/
|
|
4
|
-
export async function pageLoadTimeoutW3C(ms) {
|
|
5
|
-
await this.setPageLoadTimeout(this.parseTimeoutArgument(ms));
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @this {XCUITestDriver}
|
|
10
|
-
*/
|
|
11
|
-
export async function pageLoadTimeoutMJSONWP(ms) {
|
|
12
|
-
await this.setPageLoadTimeout(this.parseTimeoutArgument(ms));
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @this {XCUITestDriver}
|
|
17
|
-
*/
|
|
18
|
-
export async function scriptTimeoutW3C(ms) {
|
|
19
|
-
// XXX: this is synchronous
|
|
20
|
-
await this.setAsyncScriptTimeout(this.parseTimeoutArgument(ms));
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Alias for {@linkcode XCUITestDriver.scriptTimeoutW3C}.
|
|
25
|
-
*
|
|
26
|
-
* @param {number} ms - the timeout
|
|
27
|
-
* @this {XCUITestDriver}
|
|
28
|
-
* @deprecated Use {@linkcode XCUITestDriver.scriptTimeoutW3C} instead
|
|
29
|
-
*/
|
|
30
|
-
export async function scriptTimeoutMJSONWP(ms) {
|
|
31
|
-
await this.asyncScriptTimeout(ms);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Alias for {@linkcode XCUITestDriver.scriptTimeoutW3C}.
|
|
36
|
-
*
|
|
37
|
-
* @param {number} ms - the timeout
|
|
38
|
-
*
|
|
39
|
-
* @deprecated Use {@linkcode XCUITestDriver.scriptTimeoutW3C} instead
|
|
40
|
-
* @this {XCUITestDriver}
|
|
41
|
-
*/
|
|
42
|
-
export async function asyncScriptTimeout(ms) {
|
|
43
|
-
await this.scriptTimeoutW3C(ms);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* @this {XCUITestDriver}
|
|
48
|
-
*/
|
|
49
|
-
export function setPageLoadTimeout(ms) {
|
|
50
|
-
ms = parseInt(ms, 10);
|
|
51
|
-
this.pageLoadMs = ms;
|
|
52
|
-
if (this.remote) {
|
|
53
|
-
this.remote.pageLoadMs = ms;
|
|
54
|
-
}
|
|
55
|
-
this.log.debug(`Set page load timeout to ${ms}ms`);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* @this {XCUITestDriver}
|
|
60
|
-
*/
|
|
61
|
-
export function setAsyncScriptTimeout(ms) {
|
|
62
|
-
this.asyncWaitMs = ms;
|
|
63
|
-
this.log.debug(`Set async script timeout to ${ms}ms`);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
68
|
-
*/
|