appium-xcuitest-driver 10.14.2 → 10.14.4
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/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/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/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/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/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/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/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/simctl.d.ts +16 -22
- package/build/lib/commands/simctl.d.ts.map +1 -1
- package/build/lib/commands/simctl.js +8 -17
- package/build/lib/commands/simctl.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 +18 -14
- package/build/lib/commands/timeouts.js.map +1 -1
- package/lib/commands/alert.ts +98 -0
- package/lib/commands/appearance.ts +70 -0
- package/lib/commands/biometric.ts +52 -0
- package/lib/commands/content-size.ts +67 -0
- package/lib/commands/geolocation.ts +55 -0
- package/lib/commands/{iohid.js → iohid.ts} +15 -13
- package/lib/commands/keyboard.ts +70 -0
- package/lib/commands/{notifications.js → notifications.ts} +22 -14
- package/lib/commands/permissions.ts +90 -0
- package/lib/commands/{proxy-helper.js → proxy-helper.ts} +26 -26
- package/lib/commands/{simctl.js → simctl.ts} +27 -21
- package/lib/commands/timeouts.ts +95 -0
- package/npm-shrinkwrap.json +5 -5
- package/package.json +1 -1
- package/lib/commands/alert.js +0 -88
- package/lib/commands/appearance.js +0 -71
- package/lib/commands/biometric.js +0 -52
- package/lib/commands/content-size.js +0 -68
- package/lib/commands/geolocation.js +0 -56
- package/lib/commands/keyboard.js +0 -62
- package/lib/commands/permissions.js +0 -85
- package/lib/commands/timeouts.js +0 -68
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import _ from 'lodash';
|
|
2
|
-
import {util} from 'appium/support';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Set the device's UI appearance style
|
|
6
|
-
*
|
|
7
|
-
* @since iOS 12.0
|
|
8
|
-
* @param {'dark'|'light'} style - The appearance style to set
|
|
9
|
-
* @throws {Error} if the current platform does not support UI appearance changes
|
|
10
|
-
* @this {XCUITestDriver}
|
|
11
|
-
*/
|
|
12
|
-
export async function mobileSetAppearance(style) {
|
|
13
|
-
if (!['light', 'dark'].includes(_.toLower(style))) {
|
|
14
|
-
throw new Error(`The 'style' value is expected to equal either 'light' or 'dark'`);
|
|
15
|
-
}
|
|
16
|
-
if (util.compareVersions(/** @type {string} */ (this.opts.platformVersion), '<', '12.0')) {
|
|
17
|
-
throw new Error('Changing appearance is only supported since iOS 12');
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
if (this.isSimulator()) {
|
|
21
|
-
try {
|
|
22
|
-
return void (await /** @type {import('appium-ios-simulator').Simulator} */ (this.device).setAppearance(style));
|
|
23
|
-
} catch (e) {
|
|
24
|
-
this.log.debug(e.stack);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
try {
|
|
28
|
-
return void (await this.proxyCommand('/wda/device/appearance', 'POST', {name: style}, false));
|
|
29
|
-
} catch (e) {
|
|
30
|
-
this.log.debug(e.stack);
|
|
31
|
-
}
|
|
32
|
-
// Fall back to the ugly Siri workaround if the current SDK is too old
|
|
33
|
-
await this.mobileSiriCommand(`Turn ${_.toLower(style) === 'dark' ? 'on' : 'off'} dark mode`);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Get the device's UI appearance style.
|
|
38
|
-
*
|
|
39
|
-
* @since Xcode SDK 11
|
|
40
|
-
* @returns {Promise<{style: Style}>}
|
|
41
|
-
* @this {XCUITestDriver}
|
|
42
|
-
*/
|
|
43
|
-
export async function mobileGetAppearance() {
|
|
44
|
-
if (util.compareVersions(/** @type {string} */ (this.opts.platformVersion), '<', '12.0')) {
|
|
45
|
-
return {style: 'unsupported'};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/** @type {Style|undefined} */
|
|
49
|
-
let style;
|
|
50
|
-
if (this.isSimulator()) {
|
|
51
|
-
try {
|
|
52
|
-
style = /** @type {Style} */ (
|
|
53
|
-
await /** @type {import('appium-ios-simulator').Simulator} */ (this.device).getAppearance()
|
|
54
|
-
);
|
|
55
|
-
} catch {}
|
|
56
|
-
}
|
|
57
|
-
if (!style) {
|
|
58
|
-
style = /** @type {Style} */ (
|
|
59
|
-
/** @type {any} */ (await this.proxyCommand('/wda/device/info', 'GET'))
|
|
60
|
-
?.userInterfaceStyle ?? 'unknown'
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
return {
|
|
64
|
-
style,
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
70
|
-
* @typedef {import('./types').Style} Style
|
|
71
|
-
*/
|
|
@@ -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,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
|
-
*/
|
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,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/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
|
-
*/
|