appium-xcuitest-driver 10.14.3 → 10.14.5
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/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/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/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/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/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/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/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/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/lib/commands/{battery.js → battery.ts} +10 -12
- package/lib/commands/biometric.ts +52 -0
- package/lib/commands/clipboard.ts +37 -0
- package/lib/commands/content-size.ts +67 -0
- package/lib/commands/geolocation.ts +55 -0
- 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/lock.ts +43 -0
- package/lib/commands/{memory.js → memory.ts} +9 -9
- package/lib/commands/{notifications.js → notifications.ts} +22 -14
- package/lib/commands/pasteboard.ts +44 -0
- package/npm-shrinkwrap.json +29 -8
- package/package.json +1 -1
- 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/geolocation.js +0 -56
- package/lib/commands/increase-contrast.js +0 -50
- package/lib/commands/keyboard.js +0 -62
- package/lib/commands/lock.js +0 -46
- package/lib/commands/pasteboard.js +0 -43
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import {assertSimulator as _assertSimulator} from '../utils';
|
|
2
|
-
|
|
3
|
-
const assertSimulator = (driver) => _assertSimulator.call(driver, 'Biometric enrollment');
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Enrolls biometric authentication on a simulated device.
|
|
7
|
-
*
|
|
8
|
-
* @param {boolean} isEnabled - Whether to enable/disable biometric enrollment.
|
|
9
|
-
* @throws {Error} If enrollment fails or the device is not a Simulator.
|
|
10
|
-
* @group Simulator Only
|
|
11
|
-
* @this {XCUITestDriver}
|
|
12
|
-
*/
|
|
13
|
-
export async function mobileEnrollBiometric(isEnabled = true) {
|
|
14
|
-
assertSimulator(this);
|
|
15
|
-
|
|
16
|
-
await /** @type {import('appium-ios-simulator').Simulator} */ (this.device).enrollBiometric(isEnabled);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Emulates biometric match or non-match event on a simulated device.
|
|
21
|
-
*
|
|
22
|
-
* The biometric feature is expected to be already enrolled via {@linkcode mobileEnrollBiometric|mobile: enrollBiometric} before executing this.
|
|
23
|
-
*
|
|
24
|
-
* @param {import('./types').BiometricFeature} type - The biometric feature name.
|
|
25
|
-
* @param {boolean} match - If `true`, simulate biometic match. If `false`, simulate biometric non-match.
|
|
26
|
-
* @throws {Error} If matching fails or the device is not a Simulator.
|
|
27
|
-
* @group Simulator Only
|
|
28
|
-
* @this {XCUITestDriver}
|
|
29
|
-
*/
|
|
30
|
-
export async function mobileSendBiometricMatch(type = 'touchId', match = true) {
|
|
31
|
-
assertSimulator(this);
|
|
32
|
-
|
|
33
|
-
await /** @type {import('appium-ios-simulator').Simulator} */ (this.device).sendBiometricMatch(match, type);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Checks whether the biometric feature is currently enrolled on a simulated device.
|
|
38
|
-
*
|
|
39
|
-
* @returns {Promise<boolean>} `true` if biometric is enrolled.
|
|
40
|
-
* @throws {Error} If the detection fails or the device is not a Simulator.
|
|
41
|
-
* @group Simulator Only
|
|
42
|
-
* @this {XCUITestDriver}
|
|
43
|
-
*/
|
|
44
|
-
export async function mobileIsBiometricEnrolled() {
|
|
45
|
-
assertSimulator(this);
|
|
46
|
-
|
|
47
|
-
return await /** @type {import('appium-ios-simulator').Simulator} */ (this.device).isBiometricEnrolled();
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
52
|
-
*/
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sets the primary clipboard's content on the device under test.
|
|
3
|
-
*
|
|
4
|
-
* @param {string} content - The content to be set as base64 encoded string.
|
|
5
|
-
* @param {string} [contentType=plaintext] - The type of the content to set.
|
|
6
|
-
* Only `plaintext`, 'image and 'url' are supported.
|
|
7
|
-
* @this {XCUITestDriver}
|
|
8
|
-
*/
|
|
9
|
-
export async function setClipboard(content, contentType) {
|
|
10
|
-
await this.proxyCommand('/wda/setPasteboard', 'POST', {
|
|
11
|
-
content,
|
|
12
|
-
contentType,
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Gets the content of the primary clipboard on the device under test.
|
|
18
|
-
*
|
|
19
|
-
* @param {string} [contentType=plaintext] - The type of the content to get.
|
|
20
|
-
* Only `plaintext`, 'image and 'url' are supported.
|
|
21
|
-
* @returns {Promise<string>} The actual clipboard content encoded into base64 string.
|
|
22
|
-
* An empty string is returned if the clipboard contains no data.
|
|
23
|
-
* @this {XCUITestDriver}
|
|
24
|
-
*/
|
|
25
|
-
export async function getClipboard(contentType) {
|
|
26
|
-
return /** @type {string} */ (
|
|
27
|
-
await this.proxyCommand('/wda/getPasteboard', 'POST', {
|
|
28
|
-
contentType,
|
|
29
|
-
})
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
35
|
-
*/
|
|
@@ -1,68 +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 CONTENT_SIZE = [
|
|
8
|
-
'extra-small',
|
|
9
|
-
'small',
|
|
10
|
-
'medium',
|
|
11
|
-
'large',
|
|
12
|
-
'extra-large',
|
|
13
|
-
'extra-extra-large',
|
|
14
|
-
'extra-extra-extra-large',
|
|
15
|
-
'accessibility-medium',
|
|
16
|
-
'accessibility-large',
|
|
17
|
-
'accessibility-extra-large',
|
|
18
|
-
'accessibility-extra-extra-large',
|
|
19
|
-
'accessibility-extra-extra-extra-large',
|
|
20
|
-
'increment',
|
|
21
|
-
'decrement'
|
|
22
|
-
];
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Sets content size for the given simulator.
|
|
26
|
-
*
|
|
27
|
-
* @since Xcode 15 (but lower xcode could have this command)
|
|
28
|
-
* @param {ContentSizeAction} size - The content size action to set. Acceptable value is
|
|
29
|
-
* extra-small, small, medium, large, extra-large, extra-extra-large,
|
|
30
|
-
* extra-extra-extra-large, accessibility-medium, accessibility-large,
|
|
31
|
-
* accessibility-extra-large, accessibility-extra-extra-large,
|
|
32
|
-
* accessibility-extra-extra-extra-large with Xcode 16.2.
|
|
33
|
-
* @throws {Error} if the current platform does not support content size appearance changes
|
|
34
|
-
* @this {XCUITestDriver}
|
|
35
|
-
*/
|
|
36
|
-
export async function mobileSetContentSize(size) {
|
|
37
|
-
const simulator = assertSimulator(this);
|
|
38
|
-
|
|
39
|
-
if (!CONTENT_SIZE.includes(_.lowerCase(size))) {
|
|
40
|
-
throw new errors.InvalidArgumentError(
|
|
41
|
-
`The 'size' value is expected to be one of ${CONTENT_SIZE.join(',')}`
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
await simulator.setContentSize(size);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Retrieves the current content size value from the given simulator.
|
|
50
|
-
*
|
|
51
|
-
* @since Xcode 15 (but lower xcode could have this command)
|
|
52
|
-
* @returns {Promise<ContentSizeResult>} the content size value. Possible return value is
|
|
53
|
-
* extra-small, small, medium, large, extra-large, extra-extra-large,
|
|
54
|
-
* extra-extra-extra-large, accessibility-medium, accessibility-large,
|
|
55
|
-
* accessibility-extra-large, accessibility-extra-extra-large,
|
|
56
|
-
* accessibility-extra-extra-extra-large,
|
|
57
|
-
* unknown or unsupported with Xcode 16.2.
|
|
58
|
-
* @this {XCUITestDriver}
|
|
59
|
-
*/
|
|
60
|
-
export async function mobileGetContentSize() {
|
|
61
|
-
return /** @type {ContentSizeResult} */ (await assertSimulator(this).getContentSize());
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
66
|
-
* @typedef {import('./types').ContentSizeAction} ContentSizeAction
|
|
67
|
-
* @typedef {import('./types').ContentSizeResult} ContentSizeResult
|
|
68
|
-
*/
|
|
@@ -1,56 +0,0 @@
|
|
|
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
|
-
/**
|
|
12
|
-
* Retrieves the simulated geolocation value.
|
|
13
|
-
* Only works since Xcode 14.3/iOS 16.4
|
|
14
|
-
*
|
|
15
|
-
* @returns {Promise<GeolocationInfo>}
|
|
16
|
-
* @throws {Error} If the device under test does not support gelolocation simulation.
|
|
17
|
-
* @since 4.18
|
|
18
|
-
* @this {XCUITestDriver}
|
|
19
|
-
*/
|
|
20
|
-
export async function mobileGetSimulatedLocation() {
|
|
21
|
-
return await this.proxyCommand('/wda/simulatedLocation', 'GET');
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Sets simulated geolocation value.
|
|
26
|
-
* Only works since Xcode 14.3/iOS 16.4
|
|
27
|
-
*
|
|
28
|
-
* @param {number} latitude
|
|
29
|
-
* @param {number} longitude
|
|
30
|
-
* @returns {Promise<void>}
|
|
31
|
-
* @throws {Error} If the device under test does not support gelolocation simulation.
|
|
32
|
-
* @since 4.18
|
|
33
|
-
* @this {XCUITestDriver}
|
|
34
|
-
*/
|
|
35
|
-
export async function mobileSetSimulatedLocation(latitude, longitude) {
|
|
36
|
-
return await this.proxyCommand('/wda/simulatedLocation', 'POST', {latitude, longitude});
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Resets simulated geolocation value.
|
|
41
|
-
* Only works since Xcode 14.3/iOS 16.4.
|
|
42
|
-
* ! Do not forget to reset the simulated geolocation value after your automated test is finished.
|
|
43
|
-
* ! If the value is not reset explicitly then the simulated one will remain until the next device restart.
|
|
44
|
-
*
|
|
45
|
-
* @returns {Promise<void>}
|
|
46
|
-
* @throws {Error} If the device under test does not support gelolocation simulation.
|
|
47
|
-
* @since 4.18
|
|
48
|
-
* @this {XCUITestDriver}
|
|
49
|
-
*/
|
|
50
|
-
export async function mobileResetSimulatedLocation() {
|
|
51
|
-
return await this.proxyCommand('/wda/simulatedLocation', 'DELETE');
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
56
|
-
*/
|
|
@@ -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
|
-
*/
|
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 {string} 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
|
-
*/
|