appium-xcuitest-driver 10.14.3 → 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 +6 -0
- 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/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/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iohid.d.ts","sourceRoot":"","sources":["../../../lib/commands/iohid.
|
|
1
|
+
{"version":3,"file":"iohid.d.ts","sourceRoot":"","sources":["../../../lib/commands/iohid.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,YAAY,EAAC,MAAM,aAAa,CAAC;AACxD,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,WAAW,CAAC;AAE9C;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,YAAY,EAClB,KAAK,EAAE,MAAM,EACb,eAAe,EAAE,MAAM,GAAG,MAAM,GAC/B,OAAO,CAAC,IAAI,CAAC,CAcf"}
|
|
@@ -14,10 +14,9 @@ const hid_event_1 = require("./hid-event");
|
|
|
14
14
|
* - `kHIDUsage_Csmr_Power` = `0x30` (Power)
|
|
15
15
|
* - `kHIDUsage_Csmr_Snapshot` = `0x65` (Power + Home)
|
|
16
16
|
*
|
|
17
|
-
* @param
|
|
18
|
-
* @param
|
|
19
|
-
* @param
|
|
20
|
-
* @this {import('../driver').XCUITestDriver}
|
|
17
|
+
* @param page - The event page identifier
|
|
18
|
+
* @param usage - The event usage identifier (usages are defined per-page)
|
|
19
|
+
* @param durationSeconds - The event duration in float seconds (XCTest uses `0.005` for a single press event)
|
|
21
20
|
*/
|
|
22
21
|
async function mobilePerformIoHidEvent(page, usage, durationSeconds) {
|
|
23
22
|
if (!isHIDPageEvent(page)) {
|
|
@@ -30,12 +29,10 @@ async function mobilePerformIoHidEvent(page, usage, durationSeconds) {
|
|
|
30
29
|
if (Number.isNaN(duration)) {
|
|
31
30
|
throw new driver_1.errors.InvalidArgumentError(`'durationSeconds' argument must be a valid number`);
|
|
32
31
|
}
|
|
33
|
-
|
|
32
|
+
await this.proxyCommand('/wda/performIoHidEvent', 'POST', { page, usage, duration });
|
|
34
33
|
}
|
|
35
34
|
/**
|
|
36
35
|
* Type guard for {@linkcode HIDUsageEvent}
|
|
37
|
-
* @param {any} value
|
|
38
|
-
* @returns {value is HIDUsageEvent}
|
|
39
36
|
*/
|
|
40
37
|
function isHIDUsageEvent(value) {
|
|
41
38
|
if (typeof value === 'string') {
|
|
@@ -48,9 +45,7 @@ function isHIDUsageEvent(value) {
|
|
|
48
45
|
}
|
|
49
46
|
/**
|
|
50
47
|
* Type guard for {@linkcode HIDPageEvent}
|
|
51
|
-
|
|
52
|
-
* @returns {value is HIDPageEvent}
|
|
53
|
-
**/
|
|
48
|
+
*/
|
|
54
49
|
function isHIDPageEvent(value) {
|
|
55
50
|
if (typeof value === 'string') {
|
|
56
51
|
value = parseInt(value, 10);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iohid.js","sourceRoot":"","sources":["../../../lib/commands/iohid.
|
|
1
|
+
{"version":3,"file":"iohid.js","sourceRoot":"","sources":["../../../lib/commands/iohid.ts"],"names":[],"mappings":";;AAmBA,0DAmBC;AAtCD,0CAAqC;AACrC,2CAAwD;AAGxD;;;;;;;;;;;;;;GAcG;AACI,KAAK,UAAU,uBAAuB,CAE3C,IAAkB,EAClB,KAAa,EACb,eAAgC;IAEhC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,eAAM,CAAC,oBAAoB,CACnC,yDAAyD,CAC1D,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,eAAM,CAAC,oBAAoB,CAAC,kDAAkD,CAAC,CAAC;IAC5F,CAAC;IACD,MAAM,QAAQ,GAAG,UAAU,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC;IACrD,IAAI,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,eAAM,CAAC,oBAAoB,CAAC,mDAAmD,CAAC,CAAC;IAC7F,CAAC;IACD,MAAM,IAAI,CAAC,YAAY,CAAC,wBAAwB,EAAE,MAAM,EAAE,EAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAC,CAAC,CAAC;AACrF,CAAC;AAED;;GAEG;AACH,SAAS,eAAe,CAAC,KAAU;IACjC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,KAAK,GAAG,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC9B,CAAC;IACD,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACrD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,KAAK,IAAI,yBAAa,CAAC;AAChC,CAAC;AAED;;GAEG;AACH,SAAS,cAAc,CAAC,KAAU;IAChC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,KAAK,GAAG,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC9B,CAAC;IACD,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACrD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,KAAK,IAAI,wBAAY,CAAC;AAC/B,CAAC"}
|
|
@@ -1,32 +1,35 @@
|
|
|
1
|
+
import type { XCUITestDriver } from '../driver';
|
|
2
|
+
import type { KeyboardKey } from './types';
|
|
1
3
|
/**
|
|
2
|
-
*
|
|
4
|
+
* Hides the keyboard.
|
|
5
|
+
*
|
|
3
6
|
* @deprecated
|
|
4
7
|
*/
|
|
5
|
-
export function hideKeyboard(this:
|
|
8
|
+
export declare function hideKeyboard(this: XCUITestDriver, strategy?: string, ...possibleKeys: string[]): Promise<boolean>;
|
|
6
9
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
10
|
+
* Hides the keyboard using the specified key names.
|
|
11
|
+
*
|
|
12
|
+
* @param keys - Array of key names to use for dismissing the keyboard
|
|
9
13
|
*/
|
|
10
|
-
export function mobileHideKeyboard(this:
|
|
14
|
+
export declare function mobileHideKeyboard(this: XCUITestDriver, keys?: string[]): Promise<void>;
|
|
11
15
|
/**
|
|
12
|
-
*
|
|
16
|
+
* Checks whether the keyboard is currently shown.
|
|
17
|
+
*
|
|
18
|
+
* @returns `true` if the keyboard is shown, `false` otherwise
|
|
13
19
|
*/
|
|
14
|
-
export function isKeyboardShown(this:
|
|
20
|
+
export declare function isKeyboardShown(this: XCUITestDriver): Promise<boolean>;
|
|
15
21
|
/**
|
|
16
22
|
* Send keys to the given element or to the application under test.
|
|
17
23
|
* This API is not supported on tvOS
|
|
18
24
|
*
|
|
19
25
|
* @since Xcode 15/iOS 17
|
|
20
|
-
* @
|
|
21
|
-
* @param {(Key|string)[]} keys Array of keys to type.
|
|
26
|
+
* @param keys - Array of keys to type.
|
|
22
27
|
* Each item could either be a string, that represents a key itself (see
|
|
23
28
|
* https://developer.apple.com/documentation/xctest/xcuielement/1500604-typekey?language=objc
|
|
24
29
|
* and https://developer.apple.com/documentation/xctest/xcuikeyboardkey?language=objc)
|
|
25
30
|
* or a dictionary, if the key should also be entered with modifiers.
|
|
26
|
-
* @param
|
|
31
|
+
* @param elementId - UUID of the element to send keys to.
|
|
27
32
|
* If the element is not provided then the keys will be sent to the current application.
|
|
28
33
|
*/
|
|
29
|
-
export function mobileKeys(this:
|
|
30
|
-
export type XCUITestDriver = import("../driver").XCUITestDriver;
|
|
31
|
-
export type Key = import("./types").KeyboardKey;
|
|
34
|
+
export declare function mobileKeys(this: XCUITestDriver, keys: (KeyboardKey | string)[], elementId?: string | null): Promise<void>;
|
|
32
35
|
//# sourceMappingURL=keyboard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyboard.d.ts","sourceRoot":"","sources":["../../../lib/commands/keyboard.
|
|
1
|
+
{"version":3,"file":"keyboard.d.ts","sourceRoot":"","sources":["../../../lib/commands/keyboard.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;AAEzC;;;;GAIG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,cAAc,EACpB,QAAQ,CAAC,EAAE,MAAM,EACjB,GAAG,YAAY,EAAE,MAAM,EAAE,GACxB,OAAO,CAAC,OAAO,CAAC,CAKlB;AAED;;;;GAIG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,cAAc,EACpB,IAAI,GAAE,MAAM,EAAO,GAClB,OAAO,CAAC,IAAI,CAAC,CAIf;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,CAO5E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,UAAU,CAC9B,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,CAAC,WAAW,GAAG,MAAM,CAAC,EAAE,EAC9B,SAAS,GAAE,MAAM,GAAG,IAAW,GAC9B,OAAO,CAAC,IAAI,CAAC,CAGf"}
|
|
@@ -9,7 +9,8 @@ exports.isKeyboardShown = isKeyboardShown;
|
|
|
9
9
|
exports.mobileKeys = mobileKeys;
|
|
10
10
|
const lodash_1 = __importDefault(require("lodash"));
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* Hides the keyboard.
|
|
13
|
+
*
|
|
13
14
|
* @deprecated
|
|
14
15
|
*/
|
|
15
16
|
async function hideKeyboard(strategy, ...possibleKeys) {
|
|
@@ -19,17 +20,19 @@ async function hideKeyboard(strategy, ...possibleKeys) {
|
|
|
19
20
|
return true;
|
|
20
21
|
}
|
|
21
22
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
23
|
+
* Hides the keyboard using the specified key names.
|
|
24
|
+
*
|
|
25
|
+
* @param keys - Array of key names to use for dismissing the keyboard
|
|
24
26
|
*/
|
|
25
27
|
async function mobileHideKeyboard(keys = []) {
|
|
26
|
-
|
|
27
|
-
keys.
|
|
28
|
-
}
|
|
29
|
-
await this.proxyCommand('/wda/keyboard/dismiss', 'POST', { keyNames: keys });
|
|
28
|
+
await this.proxyCommand('/wda/keyboard/dismiss', 'POST', {
|
|
29
|
+
keyNames: keys.includes('done') ? keys : [...keys, 'done'],
|
|
30
|
+
});
|
|
30
31
|
}
|
|
31
32
|
/**
|
|
32
|
-
*
|
|
33
|
+
* Checks whether the keyboard is currently shown.
|
|
34
|
+
*
|
|
35
|
+
* @returns `true` if the keyboard is shown, `false` otherwise
|
|
33
36
|
*/
|
|
34
37
|
async function isKeyboardShown() {
|
|
35
38
|
try {
|
|
@@ -45,23 +48,16 @@ async function isKeyboardShown() {
|
|
|
45
48
|
* This API is not supported on tvOS
|
|
46
49
|
*
|
|
47
50
|
* @since Xcode 15/iOS 17
|
|
48
|
-
* @
|
|
49
|
-
* @param {(Key|string)[]} keys Array of keys to type.
|
|
51
|
+
* @param keys - Array of keys to type.
|
|
50
52
|
* Each item could either be a string, that represents a key itself (see
|
|
51
53
|
* https://developer.apple.com/documentation/xctest/xcuielement/1500604-typekey?language=objc
|
|
52
54
|
* and https://developer.apple.com/documentation/xctest/xcuikeyboardkey?language=objc)
|
|
53
55
|
* or a dictionary, if the key should also be entered with modifiers.
|
|
54
|
-
* @param
|
|
56
|
+
* @param elementId - UUID of the element to send keys to.
|
|
55
57
|
* If the element is not provided then the keys will be sent to the current application.
|
|
56
58
|
*/
|
|
57
59
|
async function mobileKeys(keys, elementId = null) {
|
|
58
60
|
const url = `/wda/element/${elementId || 0}/keyboardInput`;
|
|
59
|
-
|
|
61
|
+
await this.proxyCommand(url, 'POST', { keys });
|
|
60
62
|
}
|
|
61
|
-
/**
|
|
62
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
63
|
-
*/
|
|
64
|
-
/**
|
|
65
|
-
* @typedef {import('./types').KeyboardKey} Key
|
|
66
|
-
*/
|
|
67
63
|
//# sourceMappingURL=keyboard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyboard.js","sourceRoot":"","sources":["../../../lib/commands/keyboard.
|
|
1
|
+
{"version":3,"file":"keyboard.js","sourceRoot":"","sources":["../../../lib/commands/keyboard.ts"],"names":[],"mappings":";;;;;AASA,oCASC;AAOD,gDAOC;AAOD,0CAOC;AAeD,gCAOC;AApED,oDAAuB;AAIvB;;;;GAIG;AACI,KAAK,UAAU,YAAY,CAEhC,QAAiB,EACjB,GAAG,YAAsB;IAEzB,mCAAmC;IACnC,MAAM,QAAQ,GAAG,gBAAC,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACzE,MAAM,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IACxC,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;GAIG;AACI,KAAK,UAAU,kBAAkB,CAEtC,OAAiB,EAAE;IAEnB,MAAM,IAAI,CAAC,YAAY,CAAC,uBAAuB,EAAE,MAAM,EAAE;QACvD,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC;KAC3D,CAAC,CAAC;AACL,CAAC;AAED;;;;GAIG;AACI,KAAK,UAAU,eAAe;IACnC,IAAI,CAAC;QACH,MAAM,IAAI,CAAC,2BAA2B,CAAC,YAAY,EAAE,yBAAyB,EAAE,KAAK,CAAC,CAAC;QACvF,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;GAYG;AACI,KAAK,UAAU,UAAU,CAE9B,IAA8B,EAC9B,YAA2B,IAAI;IAE/B,MAAM,GAAG,GAAG,gBAAgB,SAAS,IAAI,CAAC,gBAAgB,CAAC;IAC3D,MAAM,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
+
import type { XCUITestDriver } from '../driver';
|
|
2
|
+
import type { PushPayload, NotificationType } from './types';
|
|
1
3
|
/**
|
|
2
4
|
* Simulates push notification delivery to a simulated device.
|
|
3
5
|
*
|
|
4
6
|
* **Only "remote" push notifications are supported.** VoIP, Complication, File Provider, and other types are unsupported.
|
|
5
7
|
*
|
|
6
8
|
* Supported in Xcode SDK 11.4+.
|
|
7
|
-
*
|
|
8
|
-
* @param
|
|
9
|
+
*
|
|
10
|
+
* @param bundleId - The bundle identifier of the target application
|
|
11
|
+
* @param payload - Valid push payload.
|
|
9
12
|
* @group Simulator Only
|
|
10
|
-
* @this {XCUITestDriver}
|
|
11
13
|
*/
|
|
12
|
-
export function mobilePushNotification(this:
|
|
14
|
+
export declare function mobilePushNotification(this: XCUITestDriver, bundleId: string, payload: PushPayload): Promise<void>;
|
|
13
15
|
/**
|
|
14
16
|
* Blocks until the expected notification is delivered.
|
|
15
17
|
*
|
|
@@ -17,12 +19,10 @@ export function mobilePushNotification(this: import("../driver").XCUITestDriver,
|
|
|
17
19
|
* [`XCTNSNotificationExpectation`](https://developer.apple.com/documentation/xctest/xctnsnotificationexpectation?language=objc) and
|
|
18
20
|
* [`XCTDarwinNotificationExpectation`](https://developer.apple.com/documentation/xctest/xctdarwinnotificationexpectation?language=objc) entities.
|
|
19
21
|
*
|
|
20
|
-
* @param
|
|
21
|
-
* @param
|
|
22
|
-
* @param
|
|
22
|
+
* @param name - The name of the notification to expect
|
|
23
|
+
* @param type - Which notification type to expect.
|
|
24
|
+
* @param timeoutSeconds - For how long to wait until the notification is delivered (in float seconds).
|
|
23
25
|
* @throws A [`TimeoutError`](https://www.selenium.dev/selenium/docs/api/javascript/module/selenium-webdriver/lib/error_exports_TimeoutError.html) if the expected notification has not been delivered within the given timeout.
|
|
24
|
-
* @this {XCUITestDriver}
|
|
25
26
|
*/
|
|
26
|
-
export function mobileExpectNotification(this:
|
|
27
|
-
export type XCUITestDriver = import("../driver").XCUITestDriver;
|
|
27
|
+
export declare function mobileExpectNotification(this: XCUITestDriver, name: string, type?: NotificationType, timeoutSeconds?: number): Promise<void>;
|
|
28
28
|
//# sourceMappingURL=notifications.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../../lib/commands/notifications.
|
|
1
|
+
{"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../../lib/commands/notifications.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAC,WAAW,EAAE,gBAAgB,EAAC,MAAM,SAAS,CAAC;AAG3D;;;;;;;;;;GAUG;AACH,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,cAAc,EACpB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CA0Bf;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,gBAA0B,EAChC,cAAc,GAAE,MAAW,GAC1B,OAAO,CAAC,IAAI,CAAC,CAMf"}
|
|
@@ -13,10 +13,10 @@ const lodash_1 = __importDefault(require("lodash"));
|
|
|
13
13
|
* **Only "remote" push notifications are supported.** VoIP, Complication, File Provider, and other types are unsupported.
|
|
14
14
|
*
|
|
15
15
|
* Supported in Xcode SDK 11.4+.
|
|
16
|
-
*
|
|
17
|
-
* @param
|
|
16
|
+
*
|
|
17
|
+
* @param bundleId - The bundle identifier of the target application
|
|
18
|
+
* @param payload - Valid push payload.
|
|
18
19
|
* @group Simulator Only
|
|
19
|
-
* @this {XCUITestDriver}
|
|
20
20
|
*/
|
|
21
21
|
async function mobilePushNotification(bundleId, payload) {
|
|
22
22
|
if (!this.isSimulator()) {
|
|
@@ -33,7 +33,7 @@ async function mobilePushNotification(bundleId, payload) {
|
|
|
33
33
|
throw new driver_1.errors.InvalidArgumentError(`The 'payload.aps' value must be a valid dictionary. ` +
|
|
34
34
|
`Got ${JSON.stringify(payload.aps)} instead`);
|
|
35
35
|
}
|
|
36
|
-
|
|
36
|
+
await this.device.pushNotification({
|
|
37
37
|
...payload,
|
|
38
38
|
'Simulator Target Bundle': bundleId,
|
|
39
39
|
});
|
|
@@ -45,20 +45,16 @@ async function mobilePushNotification(bundleId, payload) {
|
|
|
45
45
|
* [`XCTNSNotificationExpectation`](https://developer.apple.com/documentation/xctest/xctnsnotificationexpectation?language=objc) and
|
|
46
46
|
* [`XCTDarwinNotificationExpectation`](https://developer.apple.com/documentation/xctest/xctdarwinnotificationexpectation?language=objc) entities.
|
|
47
47
|
*
|
|
48
|
-
* @param
|
|
49
|
-
* @param
|
|
50
|
-
* @param
|
|
48
|
+
* @param name - The name of the notification to expect
|
|
49
|
+
* @param type - Which notification type to expect.
|
|
50
|
+
* @param timeoutSeconds - For how long to wait until the notification is delivered (in float seconds).
|
|
51
51
|
* @throws A [`TimeoutError`](https://www.selenium.dev/selenium/docs/api/javascript/module/selenium-webdriver/lib/error_exports_TimeoutError.html) if the expected notification has not been delivered within the given timeout.
|
|
52
|
-
* @this {XCUITestDriver}
|
|
53
52
|
*/
|
|
54
53
|
async function mobileExpectNotification(name, type = 'plain', timeoutSeconds = 60) {
|
|
55
|
-
|
|
54
|
+
await this.proxyCommand('/wda/expectNotification', 'POST', {
|
|
56
55
|
name,
|
|
57
56
|
type,
|
|
58
57
|
timeout: timeoutSeconds,
|
|
59
58
|
});
|
|
60
59
|
}
|
|
61
|
-
/**
|
|
62
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
63
|
-
*/
|
|
64
60
|
//# sourceMappingURL=notifications.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications.js","sourceRoot":"","sources":["../../../lib/commands/notifications.
|
|
1
|
+
{"version":3,"file":"notifications.js","sourceRoot":"","sources":["../../../lib/commands/notifications.ts"],"names":[],"mappings":";;;;;AAiBA,wDA8BC;AAcD,4DAWC;AAxED,0CAAqC;AACrC,oDAAuB;AAKvB;;;;;;;;;;GAUG;AACI,KAAK,UAAU,sBAAsB,CAE1C,QAAgB,EAChB,OAAoB;IAEpB,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAC5D,CAAC;IAED,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,eAAM,CAAC,oBAAoB,CACnC,8DAA8D,CAC/D,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,gBAAC,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,eAAM,CAAC,oBAAoB,CACnC,2DAA2D;YACzD,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,CAC3C,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,gBAAC,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,eAAM,CAAC,oBAAoB,CACnC,sDAAsD;YACpD,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAC/C,CAAC;IACJ,CAAC;IACD,MAAO,IAAI,CAAC,MAAoB,CAAC,gBAAgB,CAAC;QAChD,GAAG,OAAO;QACV,yBAAyB,EAAE,QAAQ;KACpC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;GAWG;AACI,KAAK,UAAU,wBAAwB,CAE5C,IAAY,EACZ,OAAyB,OAAO,EAChC,iBAAyB,EAAE;IAE3B,MAAM,IAAI,CAAC,YAAY,CAAC,yBAAyB,EAAE,MAAM,EAAE;QACzD,IAAI;QACJ,IAAI;QACJ,OAAO,EAAE,cAAc;KACxB,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import {assertSimulator as _assertSimulator} from '../utils';
|
|
2
|
+
import type {XCUITestDriver} from '../driver';
|
|
3
|
+
import type {BiometricFeature} from './types';
|
|
4
|
+
import type {Simulator} from 'appium-ios-simulator';
|
|
5
|
+
|
|
6
|
+
const assertSimulator = (driver: XCUITestDriver): Simulator => _assertSimulator.call(driver, 'Biometric enrollment');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Enrolls biometric authentication on a simulated device.
|
|
10
|
+
*
|
|
11
|
+
* @param isEnabled - Whether to enable/disable biometric enrollment.
|
|
12
|
+
* @throws If enrollment fails or the device is not a Simulator.
|
|
13
|
+
* @group Simulator Only
|
|
14
|
+
*/
|
|
15
|
+
export async function mobileEnrollBiometric(
|
|
16
|
+
this: XCUITestDriver,
|
|
17
|
+
isEnabled: boolean = true,
|
|
18
|
+
): Promise<void> {
|
|
19
|
+
await assertSimulator(this).enrollBiometric(isEnabled);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Emulates biometric match or non-match event on a simulated device.
|
|
24
|
+
*
|
|
25
|
+
* The biometric feature is expected to be already enrolled via {@linkcode mobileEnrollBiometric|mobile: enrollBiometric} before executing this.
|
|
26
|
+
*
|
|
27
|
+
* @param type - The biometric feature name.
|
|
28
|
+
* @param match - If `true`, simulate biometric match. If `false`, simulate biometric non-match.
|
|
29
|
+
* @throws If matching fails or the device is not a Simulator.
|
|
30
|
+
* @group Simulator Only
|
|
31
|
+
*/
|
|
32
|
+
export async function mobileSendBiometricMatch(
|
|
33
|
+
this: XCUITestDriver,
|
|
34
|
+
type: BiometricFeature = 'touchId',
|
|
35
|
+
match: boolean = true,
|
|
36
|
+
): Promise<void> {
|
|
37
|
+
await assertSimulator(this).sendBiometricMatch(match, type);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Checks whether the biometric feature is currently enrolled on a simulated device.
|
|
42
|
+
*
|
|
43
|
+
* @returns `true` if biometric is enrolled.
|
|
44
|
+
* @throws If the detection fails or the device is not a Simulator.
|
|
45
|
+
* @group Simulator Only
|
|
46
|
+
*/
|
|
47
|
+
export async function mobileIsBiometricEnrolled(
|
|
48
|
+
this: XCUITestDriver,
|
|
49
|
+
): Promise<boolean> {
|
|
50
|
+
return await assertSimulator(this).isBiometricEnrolled();
|
|
51
|
+
}
|
|
52
|
+
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
import {assertSimulator as _assertSimulator} from '../utils';
|
|
3
|
+
import { errors } from 'appium/driver';
|
|
4
|
+
import type {XCUITestDriver} from '../driver';
|
|
5
|
+
import type {ContentSizeAction, ContentSizeResult} from './types';
|
|
6
|
+
import type {Simulator} from 'appium-ios-simulator';
|
|
7
|
+
|
|
8
|
+
const assertSimulator = (driver: XCUITestDriver): Simulator => _assertSimulator.call(driver, 'Content size ui command');
|
|
9
|
+
|
|
10
|
+
const CONTENT_SIZE = [
|
|
11
|
+
'extra-small',
|
|
12
|
+
'small',
|
|
13
|
+
'medium',
|
|
14
|
+
'large',
|
|
15
|
+
'extra-large',
|
|
16
|
+
'extra-extra-large',
|
|
17
|
+
'extra-extra-extra-large',
|
|
18
|
+
'accessibility-medium',
|
|
19
|
+
'accessibility-large',
|
|
20
|
+
'accessibility-extra-large',
|
|
21
|
+
'accessibility-extra-extra-large',
|
|
22
|
+
'accessibility-extra-extra-extra-large',
|
|
23
|
+
'increment',
|
|
24
|
+
'decrement'
|
|
25
|
+
] as const;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Sets content size for the given simulator.
|
|
29
|
+
*
|
|
30
|
+
* @since Xcode 15 (but lower xcode could have this command)
|
|
31
|
+
* @param size - The content size action to set. Acceptable value is
|
|
32
|
+
* extra-small, small, medium, large, extra-large, extra-extra-large,
|
|
33
|
+
* extra-extra-extra-large, accessibility-medium, accessibility-large,
|
|
34
|
+
* accessibility-extra-large, accessibility-extra-extra-large,
|
|
35
|
+
* accessibility-extra-extra-extra-large with Xcode 16.2.
|
|
36
|
+
* @throws If the current platform does not support content size appearance changes
|
|
37
|
+
*/
|
|
38
|
+
export async function mobileSetContentSize(
|
|
39
|
+
this: XCUITestDriver,
|
|
40
|
+
size: ContentSizeAction,
|
|
41
|
+
): Promise<void> {
|
|
42
|
+
if (!(CONTENT_SIZE as readonly string[]).includes(_.lowerCase(size))) {
|
|
43
|
+
throw new errors.InvalidArgumentError(
|
|
44
|
+
`The 'size' value is expected to be one of ${CONTENT_SIZE.join(',')}`
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
await assertSimulator(this).setContentSize(size);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Retrieves the current content size value from the given simulator.
|
|
53
|
+
*
|
|
54
|
+
* @since Xcode 15 (but lower xcode could have this command)
|
|
55
|
+
* @returns The content size value. Possible return value is
|
|
56
|
+
* extra-small, small, medium, large, extra-large, extra-extra-large,
|
|
57
|
+
* extra-extra-extra-large, accessibility-medium, accessibility-large,
|
|
58
|
+
* accessibility-extra-large, accessibility-extra-extra-large,
|
|
59
|
+
* accessibility-extra-extra-extra-large,
|
|
60
|
+
* unknown or unsupported with Xcode 16.2.
|
|
61
|
+
*/
|
|
62
|
+
export async function mobileGetContentSize(
|
|
63
|
+
this: XCUITestDriver,
|
|
64
|
+
): Promise<ContentSizeResult> {
|
|
65
|
+
return await assertSimulator(this).getContentSize() as ContentSizeResult;
|
|
66
|
+
}
|
|
67
|
+
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type {XCUITestDriver} from '../driver';
|
|
2
|
+
|
|
3
|
+
export interface GeolocationInfo {
|
|
4
|
+
/** Measurement of distance north or south of the Equator, or `null` if {@linkcode XCUITestDriver.mobileSetSimulatedLocation} has not been called or {@linkcode mobileResetSimulatedLocation} has been called. */
|
|
5
|
+
latitude: number | null;
|
|
6
|
+
/** Measurement of distance east or west of the prime meridian, or `null` if {@linkcode XCUITestDriver.mobileSetSimulatedLocation} has not been called or {@linkcode mobileResetSimulatedLocation} has been called. */
|
|
7
|
+
longitude: number | null;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Retrieves the simulated geolocation value.
|
|
12
|
+
* Only works since Xcode 14.3/iOS 16.4
|
|
13
|
+
*
|
|
14
|
+
* @returns The current simulated geolocation
|
|
15
|
+
* @throws If the device under test does not support geolocation simulation.
|
|
16
|
+
* @since 4.18
|
|
17
|
+
*/
|
|
18
|
+
export async function mobileGetSimulatedLocation(
|
|
19
|
+
this: XCUITestDriver,
|
|
20
|
+
): Promise<GeolocationInfo> {
|
|
21
|
+
return await this.proxyCommand<any, GeolocationInfo>('/wda/simulatedLocation', 'GET');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Sets simulated geolocation value.
|
|
26
|
+
* Only works since Xcode 14.3/iOS 16.4
|
|
27
|
+
*
|
|
28
|
+
* @param latitude - Latitude value
|
|
29
|
+
* @param longitude - Longitude value
|
|
30
|
+
* @throws If the device under test does not support geolocation simulation.
|
|
31
|
+
* @since 4.18
|
|
32
|
+
*/
|
|
33
|
+
export async function mobileSetSimulatedLocation(
|
|
34
|
+
this: XCUITestDriver,
|
|
35
|
+
latitude: number,
|
|
36
|
+
longitude: number,
|
|
37
|
+
): Promise<void> {
|
|
38
|
+
await this.proxyCommand('/wda/simulatedLocation', 'POST', {latitude, longitude});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Resets simulated geolocation value.
|
|
43
|
+
* Only works since Xcode 14.3/iOS 16.4.
|
|
44
|
+
* ! Do not forget to reset the simulated geolocation value after your automated test is finished.
|
|
45
|
+
* ! If the value is not reset explicitly then the simulated one will remain until the next device restart.
|
|
46
|
+
*
|
|
47
|
+
* @throws If the device under test does not support geolocation simulation.
|
|
48
|
+
* @since 4.18
|
|
49
|
+
*/
|
|
50
|
+
export async function mobileResetSimulatedLocation(
|
|
51
|
+
this: XCUITestDriver,
|
|
52
|
+
): Promise<void> {
|
|
53
|
+
await this.proxyCommand('/wda/simulatedLocation', 'DELETE');
|
|
54
|
+
}
|
|
55
|
+
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {errors} from 'appium/driver';
|
|
2
2
|
import {HIDUsageEvent, HIDPageEvent} from './hid-event';
|
|
3
|
+
import type {XCUITestDriver} from '../driver';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Emulates triggering of the given low-level IO HID device event.
|
|
@@ -12,12 +13,16 @@ import {HIDUsageEvent, HIDPageEvent} from './hid-event';
|
|
|
12
13
|
* - `kHIDUsage_Csmr_Power` = `0x30` (Power)
|
|
13
14
|
* - `kHIDUsage_Csmr_Snapshot` = `0x65` (Power + Home)
|
|
14
15
|
*
|
|
15
|
-
* @param
|
|
16
|
-
* @param
|
|
17
|
-
* @param
|
|
18
|
-
* @this {import('../driver').XCUITestDriver}
|
|
16
|
+
* @param page - The event page identifier
|
|
17
|
+
* @param usage - The event usage identifier (usages are defined per-page)
|
|
18
|
+
* @param durationSeconds - The event duration in float seconds (XCTest uses `0.005` for a single press event)
|
|
19
19
|
*/
|
|
20
|
-
export async function mobilePerformIoHidEvent(
|
|
20
|
+
export async function mobilePerformIoHidEvent(
|
|
21
|
+
this: XCUITestDriver,
|
|
22
|
+
page: HIDPageEvent,
|
|
23
|
+
usage: number,
|
|
24
|
+
durationSeconds: number | string,
|
|
25
|
+
): Promise<void> {
|
|
21
26
|
if (!isHIDPageEvent(page)) {
|
|
22
27
|
throw new errors.InvalidArgumentError(
|
|
23
28
|
`'page' argument must be a valid HIDPageEvent identifier`,
|
|
@@ -30,15 +35,13 @@ export async function mobilePerformIoHidEvent(page, usage, durationSeconds) {
|
|
|
30
35
|
if (Number.isNaN(duration)) {
|
|
31
36
|
throw new errors.InvalidArgumentError(`'durationSeconds' argument must be a valid number`);
|
|
32
37
|
}
|
|
33
|
-
|
|
38
|
+
await this.proxyCommand('/wda/performIoHidEvent', 'POST', {page, usage, duration});
|
|
34
39
|
}
|
|
35
40
|
|
|
36
41
|
/**
|
|
37
42
|
* Type guard for {@linkcode HIDUsageEvent}
|
|
38
|
-
* @param {any} value
|
|
39
|
-
* @returns {value is HIDUsageEvent}
|
|
40
43
|
*/
|
|
41
|
-
function isHIDUsageEvent(value) {
|
|
44
|
+
function isHIDUsageEvent(value: any): value is keyof typeof HIDUsageEvent {
|
|
42
45
|
if (typeof value === 'string') {
|
|
43
46
|
value = parseInt(value, 10);
|
|
44
47
|
}
|
|
@@ -50,10 +53,8 @@ function isHIDUsageEvent(value) {
|
|
|
50
53
|
|
|
51
54
|
/**
|
|
52
55
|
* Type guard for {@linkcode HIDPageEvent}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
**/
|
|
56
|
-
function isHIDPageEvent(value) {
|
|
56
|
+
*/
|
|
57
|
+
function isHIDPageEvent(value: any): value is HIDPageEvent {
|
|
57
58
|
if (typeof value === 'string') {
|
|
58
59
|
value = parseInt(value, 10);
|
|
59
60
|
}
|
|
@@ -62,3 +63,4 @@ function isHIDPageEvent(value) {
|
|
|
62
63
|
}
|
|
63
64
|
return value in HIDPageEvent;
|
|
64
65
|
}
|
|
66
|
+
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
import type {XCUITestDriver} from '../driver';
|
|
3
|
+
import type {KeyboardKey} from './types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Hides the keyboard.
|
|
7
|
+
*
|
|
8
|
+
* @deprecated
|
|
9
|
+
*/
|
|
10
|
+
export async function hideKeyboard(
|
|
11
|
+
this: XCUITestDriver,
|
|
12
|
+
strategy?: string,
|
|
13
|
+
...possibleKeys: string[]
|
|
14
|
+
): Promise<boolean> {
|
|
15
|
+
// last parameter is the session id
|
|
16
|
+
const keyNames = _.compact(possibleKeys.slice(0, -1)).map((x) => `${x}`);
|
|
17
|
+
await this.mobileHideKeyboard(keyNames);
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Hides the keyboard using the specified key names.
|
|
23
|
+
*
|
|
24
|
+
* @param keys - Array of key names to use for dismissing the keyboard
|
|
25
|
+
*/
|
|
26
|
+
export async function mobileHideKeyboard(
|
|
27
|
+
this: XCUITestDriver,
|
|
28
|
+
keys: string[] = [],
|
|
29
|
+
): Promise<void> {
|
|
30
|
+
await this.proxyCommand('/wda/keyboard/dismiss', 'POST', {
|
|
31
|
+
keyNames: keys.includes('done') ? keys : [...keys, 'done'],
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Checks whether the keyboard is currently shown.
|
|
37
|
+
*
|
|
38
|
+
* @returns `true` if the keyboard is shown, `false` otherwise
|
|
39
|
+
*/
|
|
40
|
+
export async function isKeyboardShown(this: XCUITestDriver): Promise<boolean> {
|
|
41
|
+
try {
|
|
42
|
+
await this.findNativeElementOrElements('class name', 'XCUIElementTypeKeyboard', false);
|
|
43
|
+
return true;
|
|
44
|
+
} catch {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Send keys to the given element or to the application under test.
|
|
51
|
+
* This API is not supported on tvOS
|
|
52
|
+
*
|
|
53
|
+
* @since Xcode 15/iOS 17
|
|
54
|
+
* @param keys - Array of keys to type.
|
|
55
|
+
* Each item could either be a string, that represents a key itself (see
|
|
56
|
+
* https://developer.apple.com/documentation/xctest/xcuielement/1500604-typekey?language=objc
|
|
57
|
+
* and https://developer.apple.com/documentation/xctest/xcuikeyboardkey?language=objc)
|
|
58
|
+
* or a dictionary, if the key should also be entered with modifiers.
|
|
59
|
+
* @param elementId - UUID of the element to send keys to.
|
|
60
|
+
* If the element is not provided then the keys will be sent to the current application.
|
|
61
|
+
*/
|
|
62
|
+
export async function mobileKeys(
|
|
63
|
+
this: XCUITestDriver,
|
|
64
|
+
keys: (KeyboardKey | string)[],
|
|
65
|
+
elementId: string | null = null,
|
|
66
|
+
): Promise<void> {
|
|
67
|
+
const url = `/wda/element/${elementId || 0}/keyboardInput`;
|
|
68
|
+
await this.proxyCommand(url, 'POST', { keys });
|
|
69
|
+
}
|
|
70
|
+
|