webdriverio 9.26.0 → 9.26.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/build/commands/mobile/closeApp.d.ts +21 -3
- package/build/commands/mobile/closeApp.d.ts.map +1 -1
- package/build/commands/mobile/deepLink.d.ts +8 -3
- package/build/commands/mobile/deepLink.d.ts.map +1 -1
- package/build/commands/mobile/gsmSignal.d.ts +7 -5
- package/build/commands/mobile/gsmSignal.d.ts.map +1 -1
- package/build/commands/mobile/launchApp.d.ts +32 -3
- package/build/commands/mobile/launchApp.d.ts.map +1 -1
- package/build/commands/mobile/sendKeyEvent.d.ts +4 -2
- package/build/commands/mobile/sendKeyEvent.d.ts.map +1 -1
- package/build/commands/mobile/startActivity.d.ts +73 -13
- package/build/commands/mobile/startActivity.d.ts.map +1 -1
- package/build/commands/mobile/touchId.d.ts +13 -6
- package/build/commands/mobile/touchId.d.ts.map +1 -1
- package/build/commands/mobile/unlock.d.ts +25 -1
- package/build/commands/mobile/unlock.d.ts.map +1 -1
- package/build/index.js +86 -35
- package/build/node.js +84 -35
- package/package.json +7 -7
|
@@ -1,17 +1,35 @@
|
|
|
1
1
|
/**
|
|
2
2
|
*
|
|
3
|
-
* Close the currently
|
|
3
|
+
* Close a specific app or the currently active app on the device.
|
|
4
4
|
*
|
|
5
5
|
* > **Note:** Falls back to the deprecated Appium 2 protocol endpoint if the driver does not support the `mobile:` execute method.
|
|
6
6
|
*
|
|
7
|
+
* If no `bundleId` (iOS) or `appId` (Android) is provided, the command will automatically detect and close the currently active app.
|
|
8
|
+
*
|
|
7
9
|
* <example>
|
|
8
10
|
:closeApp.js
|
|
9
|
-
it('should close the
|
|
11
|
+
it('should close the currently active app', async () => {
|
|
12
|
+
// Automatically close the currently active app
|
|
10
13
|
await browser.closeApp()
|
|
11
14
|
})
|
|
15
|
+
it('should close a specific iOS app by bundleId', async () => {
|
|
16
|
+
// iOS: close a specific app using its bundle ID
|
|
17
|
+
await browser.closeApp({ bundleId: 'com.example.myapp' })
|
|
18
|
+
})
|
|
19
|
+
it('should close a specific Android app by appId', async () => {
|
|
20
|
+
// Android: close a specific app using its package name
|
|
21
|
+
await browser.closeApp({ appId: 'com.example.myapp' })
|
|
22
|
+
})
|
|
12
23
|
* </example>
|
|
13
24
|
*
|
|
25
|
+
* @param {object} [options] Options for closing the app (optional)
|
|
26
|
+
* @param {string} [options.bundleId] The bundle ID of the iOS app to close. If not provided, the currently active app is closed. <br /><strong>iOS-ONLY</strong>
|
|
27
|
+
* @param {string} [options.appId] The package name of the Android app to close. If not provided, the currently active app is closed. <br /><strong>ANDROID-ONLY</strong>
|
|
28
|
+
*
|
|
14
29
|
* @support ["ios","android"]
|
|
15
30
|
*/
|
|
16
|
-
export declare function closeApp(this: WebdriverIO.Browser
|
|
31
|
+
export declare function closeApp(this: WebdriverIO.Browser, options?: {
|
|
32
|
+
bundleId?: string;
|
|
33
|
+
appId?: string;
|
|
34
|
+
}): Promise<unknown>;
|
|
17
35
|
//# sourceMappingURL=closeApp.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"closeApp.d.ts","sourceRoot":"","sources":["../../../src/commands/mobile/closeApp.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"closeApp.d.ts","sourceRoot":"","sources":["../../../src/commands/mobile/closeApp.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAsB,QAAQ,CAC1B,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,OAAO,CAAC,EAAE;IACN,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;CACjB,oBA6BJ"}
|
|
@@ -14,12 +14,17 @@
|
|
|
14
14
|
// Or if you want to have it "cross-platform" you can use it like this
|
|
15
15
|
await browser.deepLink('wdio://drag', browser.isIOS ? 'org.reactjs.native.example.wdiodemoapp' : 'com.wdiodemoapp');
|
|
16
16
|
})
|
|
17
|
+
it('should open a deep link without waiting for the app to launch (Android)', async () => {
|
|
18
|
+
// Android-only: do not wait for the app to launch after opening the deep link
|
|
19
|
+
await browser.deepLink('wdio://drag', 'com.wdiodemoapp', false)
|
|
20
|
+
})
|
|
17
21
|
* </example>
|
|
18
22
|
*
|
|
19
|
-
* @param {string}
|
|
20
|
-
* @param {string}
|
|
23
|
+
* @param {string} link The deep link URL that should be opened in the mobile app. It should be a valid deep link URL (e.g. `myapp://path`). If it's a universal deep link, which can be used for iOS, use the `browser.url("your-url")`-method.
|
|
24
|
+
* @param {string} appIdentifier The value of the `package` (Android) or `bundleId` (iOS) of the app that the deep link should open.
|
|
25
|
+
* @param {boolean} [waitForLaunch] Whether to wait for the app to launch after opening the deep link. Default is `true`. <br /><strong>ANDROID-ONLY</strong>
|
|
21
26
|
*
|
|
22
27
|
* @support ["ios","android"]
|
|
23
28
|
*/
|
|
24
|
-
export declare function deepLink(this: WebdriverIO.Browser, link: string, appIdentifier: string): Promise<unknown>;
|
|
29
|
+
export declare function deepLink(this: WebdriverIO.Browser, link: string, appIdentifier: string, waitForLaunch?: boolean): Promise<unknown>;
|
|
25
30
|
//# sourceMappingURL=deepLink.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deepLink.d.ts","sourceRoot":"","sources":["../../../src/commands/mobile/deepLink.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"deepLink.d.ts","sourceRoot":"","sources":["../../../src/commands/mobile/deepLink.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,QAAQ,CAC1B,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,IAAI,EAAE,MAAM,EACZ,aAAa,EAAE,MAAM,EACrB,aAAa,CAAC,EAAE,OAAO,oBA6B1B"}
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
*
|
|
3
|
-
* Set the GSM signal strength on the Android emulator.
|
|
4
|
-
* no signal and 4 is full signal.
|
|
3
|
+
* Set the GSM signal strength on the Android emulator.
|
|
5
4
|
*
|
|
6
5
|
* > **Note:** Falls back to the deprecated Appium 2 protocol endpoint if the driver does not support the `mobile:` execute method.
|
|
7
6
|
*
|
|
8
7
|
* <example>
|
|
9
8
|
:gsmSignal.js
|
|
10
9
|
it('should set GSM signal to full strength', async () => {
|
|
11
|
-
await browser.gsmSignal(
|
|
10
|
+
await browser.gsmSignal(4)
|
|
11
|
+
})
|
|
12
|
+
it('should set GSM signal to no signal', async () => {
|
|
13
|
+
await browser.gsmSignal(0)
|
|
12
14
|
})
|
|
13
15
|
* </example>
|
|
14
16
|
*
|
|
15
|
-
* @param {
|
|
17
|
+
* @param {number} signalStrength The signal strength to set. Accepted values: `0` (no signal), `1` (very poor), `2` (poor), `3` (moderate), `4` (good/full)
|
|
16
18
|
*
|
|
17
19
|
* @support ["android"]
|
|
18
20
|
*/
|
|
19
|
-
export declare function gsmSignal(this: WebdriverIO.Browser, signalStrength:
|
|
21
|
+
export declare function gsmSignal(this: WebdriverIO.Browser, signalStrength: number): Promise<unknown>;
|
|
20
22
|
//# sourceMappingURL=gsmSignal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gsmSignal.d.ts","sourceRoot":"","sources":["../../../src/commands/mobile/gsmSignal.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"gsmSignal.d.ts","sourceRoot":"","sources":["../../../src/commands/mobile/gsmSignal.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,SAAS,CAC3B,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,cAAc,EAAE,MAAM,oBAsBzB"}
|
|
@@ -1,17 +1,46 @@
|
|
|
1
1
|
/**
|
|
2
2
|
*
|
|
3
|
-
* Launch
|
|
3
|
+
* Launch or activate an app on the device. If no `bundleId` (iOS) or `appId` (Android) is provided,
|
|
4
|
+
* the command will automatically detect and activate the currently active app.
|
|
4
5
|
*
|
|
5
6
|
* > **Note:** Falls back to the deprecated Appium 2 protocol endpoint if the driver does not support the `mobile:` execute method.
|
|
6
7
|
*
|
|
7
8
|
* <example>
|
|
8
9
|
:launchApp.js
|
|
9
|
-
it('should launch
|
|
10
|
+
it('should launch a specific iOS app', async () => {
|
|
11
|
+
// iOS: launch a specific app by bundle ID
|
|
12
|
+
await browser.launchApp({ bundleId: 'com.example.myapp' })
|
|
13
|
+
})
|
|
14
|
+
it('should launch an iOS app with arguments and environment', async () => {
|
|
15
|
+
// iOS: launch an app and pass arguments and environment variables
|
|
16
|
+
await browser.launchApp({
|
|
17
|
+
bundleId: 'com.example.myapp',
|
|
18
|
+
arguments: ['-AppleLanguages', '(en)'],
|
|
19
|
+
environment: { MY_ENV_VAR: 'value' }
|
|
20
|
+
})
|
|
21
|
+
})
|
|
22
|
+
it('should launch a specific Android app', async () => {
|
|
23
|
+
// Android: activate/launch a specific app by package name
|
|
24
|
+
await browser.launchApp({ appId: 'com.example.myapp' })
|
|
25
|
+
})
|
|
26
|
+
it('should activate the currently active app', async () => {
|
|
27
|
+
// Automatically detect and activate the current app
|
|
10
28
|
await browser.launchApp()
|
|
11
29
|
})
|
|
12
30
|
* </example>
|
|
13
31
|
*
|
|
32
|
+
* @param {object} [options] Options for launching the app (optional)
|
|
33
|
+
* @param {string} [options.bundleId] The bundle ID of the iOS app to launch. If not provided, the currently active app is used. <br /><strong>iOS-ONLY</strong>
|
|
34
|
+
* @param {string|string[]} [options.arguments] Command line arguments to pass to the app on launch. <br /><strong>iOS-ONLY</strong>
|
|
35
|
+
* @param {object} [options.environment] Environment variables to set when launching the app (key-value pairs). <br /><strong>iOS-ONLY</strong>
|
|
36
|
+
* @param {string} [options.appId] The package name of the Android app to activate. If not provided, the currently active app is used. <br /><strong>ANDROID-ONLY</strong>
|
|
37
|
+
*
|
|
14
38
|
* @support ["ios","android"]
|
|
15
39
|
*/
|
|
16
|
-
export declare function launchApp(this: WebdriverIO.Browser
|
|
40
|
+
export declare function launchApp(this: WebdriverIO.Browser, options?: {
|
|
41
|
+
bundleId?: string;
|
|
42
|
+
arguments?: string | string[];
|
|
43
|
+
environment?: Record<string, string>;
|
|
44
|
+
appId?: string;
|
|
45
|
+
}): Promise<unknown>;
|
|
17
46
|
//# sourceMappingURL=launchApp.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"launchApp.d.ts","sourceRoot":"","sources":["../../../src/commands/mobile/launchApp.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"launchApp.d.ts","sourceRoot":"","sources":["../../../src/commands/mobile/launchApp.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAsB,SAAS,CAC3B,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,OAAO,CAAC,EAAE;IACN,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACpC,KAAK,CAAC,EAAE,MAAM,CAAA;CACjB,oBAsCJ"}
|
|
@@ -12,11 +12,13 @@
|
|
|
12
12
|
it('should send a key event', async () => {
|
|
13
13
|
// Send the Home key event (keycode '3')
|
|
14
14
|
await browser.sendKeyEvent('3')
|
|
15
|
+
// Send Shift+A (keycode '29', metastate '1')
|
|
16
|
+
await browser.sendKeyEvent('29', '1')
|
|
15
17
|
})
|
|
16
18
|
* </example>
|
|
17
19
|
*
|
|
18
|
-
* @param {string} keycode The keycode to send (as a string, e.g. '3' for Home)
|
|
19
|
-
* @param {string} [metastate]
|
|
20
|
+
* @param {string} keycode The keycode to send (as a string, e.g. `'3'` for Home). See [Android KeyEvent](https://developer.android.com/reference/android/view/KeyEvent) for all available keycodes.
|
|
21
|
+
* @param {string} [metastate] The meta state to apply during the key press as a string (e.g. `'1'` for Shift). See [Android KeyEvent](https://developer.android.com/reference/android/view/KeyEvent) for all meta state values.
|
|
20
22
|
*
|
|
21
23
|
* @support ["android"]
|
|
22
24
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sendKeyEvent.d.ts","sourceRoot":"","sources":["../../../src/commands/mobile/sendKeyEvent.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"sendKeyEvent.d.ts","sourceRoot":"","sources":["../../../src/commands/mobile/sendKeyEvent.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,YAAY,CAC9B,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,OAAO,EAAE,MAAM,EACf,SAAS,CAAC,EAAE,MAAM,oBAyBrB"}
|
|
@@ -1,30 +1,90 @@
|
|
|
1
|
+
export interface StartActivityOptions {
|
|
2
|
+
/**
|
|
3
|
+
* The package name of the app to start.
|
|
4
|
+
*/
|
|
5
|
+
appPackage: string;
|
|
6
|
+
/**
|
|
7
|
+
* The activity name to start.
|
|
8
|
+
*/
|
|
9
|
+
appActivity: string;
|
|
10
|
+
/**
|
|
11
|
+
* The package name to wait for after starting the activity. Passed to the legacy fallback only.
|
|
12
|
+
* <br /><strong>LEGACY-ONLY</strong>
|
|
13
|
+
*/
|
|
14
|
+
appWaitPackage?: string;
|
|
15
|
+
/**
|
|
16
|
+
* The activity name to wait for after starting the activity. Passed to the legacy fallback only.
|
|
17
|
+
* <br /><strong>LEGACY-ONLY</strong>
|
|
18
|
+
*/
|
|
19
|
+
appWaitActivity?: string;
|
|
20
|
+
/**
|
|
21
|
+
* The intent action to use to start the activity (maps to `action` in the new driver API).
|
|
22
|
+
*/
|
|
23
|
+
intentAction?: string;
|
|
24
|
+
/**
|
|
25
|
+
* The intent category to use to start the activity (maps to `categories` in the new driver API).
|
|
26
|
+
*/
|
|
27
|
+
intentCategory?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Flags to use when starting the activity (maps to `flags` in the new driver API).
|
|
30
|
+
*/
|
|
31
|
+
intentFlags?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Additional intent arguments. Passed to the legacy fallback only.
|
|
34
|
+
* <br /><strong>LEGACY-ONLY</strong>
|
|
35
|
+
*/
|
|
36
|
+
optionalIntentArguments?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Whether to stop the app before starting the activity. Passed as `stop` (inverted) to the new driver API.
|
|
39
|
+
*/
|
|
40
|
+
dontStopAppOnReset?: string;
|
|
41
|
+
}
|
|
1
42
|
/**
|
|
2
43
|
*
|
|
3
44
|
* Start an Android activity by providing package name and activity name.
|
|
4
45
|
*
|
|
46
|
+
* Supports both the legacy positional argument style and a new object-based style.
|
|
47
|
+
* When the first argument is an object, the object properties are used. When it is a
|
|
48
|
+
* string, the call is treated as the old positional API for backward compatibility.
|
|
49
|
+
*
|
|
5
50
|
* > **Note:** Falls back to the deprecated Appium 2 protocol endpoint if the driver does not support the `mobile:` execute method.
|
|
6
51
|
*
|
|
7
52
|
* <example>
|
|
8
53
|
:startActivity.js
|
|
9
|
-
it('should start an Android activity', async () => {
|
|
10
|
-
//
|
|
54
|
+
it('should start an Android activity (object API)', async () => {
|
|
55
|
+
// New object-based API
|
|
56
|
+
await browser.startActivity({
|
|
57
|
+
appPackage: 'com.example.app',
|
|
58
|
+
appActivity: '.MainActivity',
|
|
59
|
+
})
|
|
60
|
+
// With optional intent parameters
|
|
61
|
+
await browser.startActivity({
|
|
62
|
+
appPackage: 'com.example.app',
|
|
63
|
+
appActivity: '.MainActivity',
|
|
64
|
+
intentAction: 'android.intent.action.MAIN',
|
|
65
|
+
intentCategory: 'android.intent.category.LAUNCHER',
|
|
66
|
+
intentFlags: '0x10200000',
|
|
67
|
+
})
|
|
68
|
+
})
|
|
69
|
+
it('should start an Android activity (legacy positional API)', async () => {
|
|
70
|
+
// Legacy positional API (backward compatible)
|
|
11
71
|
await browser.startActivity('com.example.app', '.MainActivity')
|
|
12
|
-
//
|
|
72
|
+
// With wait package/activity
|
|
13
73
|
await browser.startActivity('com.example.app', '.SplashActivity', 'com.example.app', '.MainActivity')
|
|
14
74
|
})
|
|
15
75
|
* </example>
|
|
16
76
|
*
|
|
17
|
-
* @param {string}
|
|
18
|
-
* @param {string}
|
|
19
|
-
* @param {string}
|
|
20
|
-
* @param {string}
|
|
21
|
-
* @param {string}
|
|
22
|
-
* @param {string}
|
|
23
|
-
* @param {string}
|
|
24
|
-
* @param {string}
|
|
25
|
-
* @param {string}
|
|
77
|
+
* @param {StartActivityOptions|string} appPackageOrOptions The package name of the app to start, or an options object.
|
|
78
|
+
* @param {string} [appActivity] The activity name to start (only used when first arg is a string).
|
|
79
|
+
* @param {string} [appWaitPackage] The package name to wait for (legacy, only used when first arg is a string). <br /><strong>LEGACY-ONLY</strong>
|
|
80
|
+
* @param {string} [appWaitActivity] The activity name to wait for (legacy, only used when first arg is a string). <br /><strong>LEGACY-ONLY</strong>
|
|
81
|
+
* @param {string} [intentAction] The intent action (legacy positional, only used when first arg is a string).
|
|
82
|
+
* @param {string} [intentCategory] The intent category (legacy positional, only used when first arg is a string).
|
|
83
|
+
* @param {string} [intentFlags] Flags for the intent (legacy positional, only used when first arg is a string).
|
|
84
|
+
* @param {string} [optionalIntentArguments] Additional intent arguments (legacy, only used when first arg is a string). <br /><strong>LEGACY-ONLY</strong>
|
|
85
|
+
* @param {string} [dontStopAppOnReset] Whether to stop the app before starting the activity (legacy positional, only used when first arg is a string).
|
|
26
86
|
*
|
|
27
87
|
* @support ["android"]
|
|
28
88
|
*/
|
|
29
|
-
export declare function startActivity(this: WebdriverIO.Browser,
|
|
89
|
+
export declare function startActivity(this: WebdriverIO.Browser, appPackageOrOptions: StartActivityOptions | string, appActivity?: string, appWaitPackage?: string, appWaitActivity?: string, intentAction?: string, intentCategory?: string, intentFlags?: string, optionalIntentArguments?: string, dontStopAppOnReset?: string): Promise<unknown>;
|
|
30
90
|
//# sourceMappingURL=startActivity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"startActivity.d.ts","sourceRoot":"","sources":["../../../src/commands/mobile/startActivity.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"startActivity.d.ts","sourceRoot":"","sources":["../../../src/commands/mobile/startActivity.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,oBAAoB;IACjC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;OAGG;IACH,uBAAuB,CAAC,EAAE,MAAM,CAAA;IAChC;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC9B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,wBAAsB,aAAa,CAC/B,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,mBAAmB,EAAE,oBAAoB,GAAG,MAAM,EAClD,WAAW,CAAC,EAAE,MAAM,EACpB,cAAc,CAAC,EAAE,MAAM,EACvB,eAAe,CAAC,EAAE,MAAM,EACxB,YAAY,CAAC,EAAE,MAAM,EACrB,cAAc,CAAC,EAAE,MAAM,EACvB,WAAW,CAAC,EAAE,MAAM,EACpB,uBAAuB,CAAC,EAAE,MAAM,EAChC,kBAAkB,CAAC,EAAE,MAAM,oBA8D9B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
*
|
|
3
|
-
* Simulate a Touch ID
|
|
3
|
+
* Simulate a Touch ID or Face ID biometric match event on iOS Simulator.
|
|
4
4
|
*
|
|
5
5
|
* > **Note:** Falls back to the deprecated Appium 2 protocol endpoint if the driver does not support the `mobile:` execute method.
|
|
6
6
|
*
|
|
@@ -11,17 +11,24 @@
|
|
|
11
11
|
*
|
|
12
12
|
* <example>
|
|
13
13
|
:touchId.js
|
|
14
|
-
it('should simulate a fingerprint match', async () => {
|
|
15
|
-
// Simulate successful
|
|
14
|
+
it('should simulate a Touch ID fingerprint match', async () => {
|
|
15
|
+
// Simulate a successful Touch ID match
|
|
16
16
|
await browser.touchId(true)
|
|
17
|
-
// Simulate failed
|
|
17
|
+
// Simulate a failed Touch ID match
|
|
18
18
|
await browser.touchId(false)
|
|
19
19
|
})
|
|
20
|
+
it('should simulate a Face ID match', async () => {
|
|
21
|
+
// Simulate a successful Face ID match
|
|
22
|
+
await browser.touchId(true, 'faceId')
|
|
23
|
+
// Simulate a failed Face ID match
|
|
24
|
+
await browser.touchId(false, 'faceId')
|
|
25
|
+
})
|
|
20
26
|
* </example>
|
|
21
27
|
*
|
|
22
|
-
* @param {boolean} match Whether the
|
|
28
|
+
* @param {boolean} match Whether the biometric match should succeed (`true`) or fail (`false`)
|
|
29
|
+
* @param {string} [type] The biometric type to simulate. Use `'touchId'` for Touch ID (default) or `'faceId'` for Face ID. <br /><strong>iOS-ONLY</strong>
|
|
23
30
|
*
|
|
24
31
|
* @support ["ios"]
|
|
25
32
|
*/
|
|
26
|
-
export declare function touchId(this: WebdriverIO.Browser, match: boolean): Promise<unknown>;
|
|
33
|
+
export declare function touchId(this: WebdriverIO.Browser, match: boolean, type?: 'touchId' | 'faceId'): Promise<unknown>;
|
|
27
34
|
//# sourceMappingURL=touchId.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"touchId.d.ts","sourceRoot":"","sources":["../../../src/commands/mobile/touchId.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"touchId.d.ts","sourceRoot":"","sources":["../../../src/commands/mobile/touchId.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAsB,OAAO,CACzB,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,KAAK,EAAE,OAAO,EACd,IAAI,GAAE,SAAS,GAAG,QAAoB,oBAsBzC"}
|
|
@@ -7,11 +7,35 @@
|
|
|
7
7
|
* <example>
|
|
8
8
|
:unlock.js
|
|
9
9
|
it('should unlock the device screen', async () => {
|
|
10
|
+
// Unlock with no arguments (iOS or Android with default settings)
|
|
10
11
|
await browser.unlock()
|
|
11
12
|
})
|
|
13
|
+
it('should unlock Android with a PIN', async () => {
|
|
14
|
+
// Android-only: unlock using locksettings strategy with a PIN
|
|
15
|
+
await browser.unlock({
|
|
16
|
+
strategy: 'locksettings',
|
|
17
|
+
unlockType: 'pin',
|
|
18
|
+
unlockKey: '1234'
|
|
19
|
+
})
|
|
20
|
+
})
|
|
21
|
+
it('should unlock Android with a custom timeout', async () => {
|
|
22
|
+
// Android-only: unlock with a custom timeout
|
|
23
|
+
await browser.unlock({ timeoutMs: 5000 })
|
|
24
|
+
})
|
|
12
25
|
* </example>
|
|
13
26
|
*
|
|
27
|
+
* @param {object} [options] Unlock options (Android only)
|
|
28
|
+
* @param {string} [options.strategy] The unlock strategy to use. Accepted values: `'locksettings'` (default) or `'uiautomator'`. <br /><strong>ANDROID-ONLY</strong>
|
|
29
|
+
* @param {number} [options.timeoutMs] The timeout in milliseconds to wait for the unlock to complete. Default is `2000`. <br /><strong>ANDROID-ONLY</strong>
|
|
30
|
+
* @param {string} [options.unlockKey] The PIN, password, or pattern to use for unlocking. Required when the device has a PIN/password lock. <br /><strong>ANDROID-ONLY</strong>
|
|
31
|
+
* @param {string} [options.unlockType] The type of lock mechanism on the device (e.g. `'pin'`, `'password'`, `'pattern'`). <br /><strong>ANDROID-ONLY</strong>
|
|
32
|
+
*
|
|
14
33
|
* @support ["ios","android"]
|
|
15
34
|
*/
|
|
16
|
-
export declare function unlock(this: WebdriverIO.Browser
|
|
35
|
+
export declare function unlock(this: WebdriverIO.Browser, options?: {
|
|
36
|
+
strategy?: 'locksettings' | 'uiautomator';
|
|
37
|
+
timeoutMs?: number;
|
|
38
|
+
unlockKey?: string;
|
|
39
|
+
unlockType?: string;
|
|
40
|
+
}): Promise<unknown>;
|
|
17
41
|
//# sourceMappingURL=unlock.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unlock.d.ts","sourceRoot":"","sources":["../../../src/commands/mobile/unlock.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"unlock.d.ts","sourceRoot":"","sources":["../../../src/commands/mobile/unlock.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAsB,MAAM,CACxB,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,OAAO,CAAC,EAAE;IACN,QAAQ,CAAC,EAAE,cAAc,GAAG,aAAa,CAAA;IACzC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;CACtB,oBAsBJ"}
|
package/build/index.js
CHANGED
|
@@ -6479,7 +6479,7 @@ async function relaunchActiveApp() {
|
|
|
6479
6479
|
}
|
|
6480
6480
|
|
|
6481
6481
|
// src/commands/mobile/deepLink.ts
|
|
6482
|
-
async function deepLink(link, appIdentifier) {
|
|
6482
|
+
async function deepLink(link, appIdentifier, waitForLaunch) {
|
|
6483
6483
|
const browser = this;
|
|
6484
6484
|
if (!browser.isMobile) {
|
|
6485
6485
|
throw new Error("The `deepLink` command is only available for mobile platforms.");
|
|
@@ -6492,10 +6492,14 @@ async function deepLink(link, appIdentifier) {
|
|
|
6492
6492
|
const identifierValue = browser.isIOS ? "bundleId" : "package";
|
|
6493
6493
|
throw new Error("When using a deep link URL for ".concat(mobileOS, ", you need to provide the `").concat(identifierValue, "` of the app that the deep link should open."));
|
|
6494
6494
|
}
|
|
6495
|
-
|
|
6495
|
+
const args = {
|
|
6496
6496
|
url: link,
|
|
6497
6497
|
[browser.isIOS ? "bundleId" : "package"]: appIdentifier
|
|
6498
|
-
}
|
|
6498
|
+
};
|
|
6499
|
+
if (!browser.isIOS && waitForLaunch !== void 0) {
|
|
6500
|
+
args.waitForLaunch = waitForLaunch;
|
|
6501
|
+
}
|
|
6502
|
+
return browser.execute("mobile:deepLink", args);
|
|
6499
6503
|
}
|
|
6500
6504
|
function isDeepLinkUrl(link) {
|
|
6501
6505
|
const deepLinkRegex = /^(?!https?:\/\/)[a-zA-Z][\w+\-.]*:\/\//;
|
|
@@ -6520,7 +6524,7 @@ async function lock(seconds) {
|
|
|
6520
6524
|
}
|
|
6521
6525
|
|
|
6522
6526
|
// src/commands/mobile/touchId.ts
|
|
6523
|
-
async function touchId(match) {
|
|
6527
|
+
async function touchId(match, type = "touchId") {
|
|
6524
6528
|
const browser = this;
|
|
6525
6529
|
if (!browser.isMobile) {
|
|
6526
6530
|
throw new Error("The `touchId` command is only available for mobile platforms.");
|
|
@@ -6529,7 +6533,7 @@ async function touchId(match) {
|
|
|
6529
6533
|
throw new Error("The `touchId` command is only available for iOS. For Android, use `fingerPrint` instead.");
|
|
6530
6534
|
}
|
|
6531
6535
|
try {
|
|
6532
|
-
return await browser.execute("mobile: sendBiometricMatch", { match });
|
|
6536
|
+
return await browser.execute("mobile: sendBiometricMatch", { match, type });
|
|
6533
6537
|
} catch (err) {
|
|
6534
6538
|
if (!isUnknownMethodError(err)) {
|
|
6535
6539
|
throw err;
|
|
@@ -6560,14 +6564,31 @@ async function toggleEnrollTouchId(enabled) {
|
|
|
6560
6564
|
}
|
|
6561
6565
|
|
|
6562
6566
|
// src/commands/mobile/launchApp.ts
|
|
6563
|
-
async function launchApp() {
|
|
6567
|
+
async function launchApp(options) {
|
|
6568
|
+
var _a, _b;
|
|
6564
6569
|
const browser = this;
|
|
6565
6570
|
if (!browser.isMobile) {
|
|
6566
6571
|
throw new Error("The `launchApp` command is only available for mobile platforms.");
|
|
6567
6572
|
}
|
|
6568
|
-
|
|
6573
|
+
let mobileCmd;
|
|
6574
|
+
let mobileArgs;
|
|
6575
|
+
if (browser.isIOS) {
|
|
6576
|
+
mobileCmd = "mobile: launchApp";
|
|
6577
|
+
const bundleId = (_a = options == null ? void 0 : options.bundleId) != null ? _a : (await browser.execute("mobile: activeAppInfo")).bundleId;
|
|
6578
|
+
mobileArgs = { bundleId };
|
|
6579
|
+
if ((options == null ? void 0 : options.arguments) !== void 0) {
|
|
6580
|
+
mobileArgs.arguments = options.arguments;
|
|
6581
|
+
}
|
|
6582
|
+
if ((options == null ? void 0 : options.environment) !== void 0) {
|
|
6583
|
+
mobileArgs.environment = options.environment;
|
|
6584
|
+
}
|
|
6585
|
+
} else {
|
|
6586
|
+
mobileCmd = "mobile: activateApp";
|
|
6587
|
+
const appId = (_b = options == null ? void 0 : options.appId) != null ? _b : await browser.getCurrentPackage();
|
|
6588
|
+
mobileArgs = { appId };
|
|
6589
|
+
}
|
|
6569
6590
|
try {
|
|
6570
|
-
return await browser.execute(mobileCmd,
|
|
6591
|
+
return await browser.execute(mobileCmd, mobileArgs);
|
|
6571
6592
|
} catch (err) {
|
|
6572
6593
|
if (!isUnknownMethodError(err)) {
|
|
6573
6594
|
throw err;
|
|
@@ -6723,13 +6744,14 @@ async function toggleWiFi(enabled) {
|
|
|
6723
6744
|
}
|
|
6724
6745
|
|
|
6725
6746
|
// src/commands/mobile/unlock.ts
|
|
6726
|
-
async function unlock() {
|
|
6747
|
+
async function unlock(options) {
|
|
6727
6748
|
const browser = this;
|
|
6728
6749
|
if (!browser.isMobile) {
|
|
6729
6750
|
throw new Error("The `unlock` command is only available for mobile platforms.");
|
|
6730
6751
|
}
|
|
6752
|
+
const args = browser.isAndroid && options ? { ...options } : {};
|
|
6731
6753
|
try {
|
|
6732
|
-
return await browser.execute("mobile: unlock",
|
|
6754
|
+
return await browser.execute("mobile: unlock", args);
|
|
6733
6755
|
} catch (err) {
|
|
6734
6756
|
if (!isUnknownMethodError(err)) {
|
|
6735
6757
|
throw err;
|
|
@@ -6777,13 +6799,22 @@ async function shake() {
|
|
|
6777
6799
|
}
|
|
6778
6800
|
|
|
6779
6801
|
// src/commands/mobile/closeApp.ts
|
|
6780
|
-
async function closeApp() {
|
|
6802
|
+
async function closeApp(options) {
|
|
6803
|
+
var _a, _b;
|
|
6781
6804
|
const browser = this;
|
|
6782
6805
|
if (!browser.isMobile) {
|
|
6783
6806
|
throw new Error("The `closeApp` command is only available for mobile platforms.");
|
|
6784
6807
|
}
|
|
6808
|
+
let terminateArgs;
|
|
6809
|
+
if (browser.isIOS) {
|
|
6810
|
+
const bundleId = (_a = options == null ? void 0 : options.bundleId) != null ? _a : (await browser.execute("mobile: activeAppInfo")).bundleId;
|
|
6811
|
+
terminateArgs = { bundleId };
|
|
6812
|
+
} else {
|
|
6813
|
+
const appId = (_b = options == null ? void 0 : options.appId) != null ? _b : await browser.getCurrentPackage();
|
|
6814
|
+
terminateArgs = { appId };
|
|
6815
|
+
}
|
|
6785
6816
|
try {
|
|
6786
|
-
return await browser.execute("mobile: terminateApp",
|
|
6817
|
+
return await browser.execute("mobile: terminateApp", terminateArgs);
|
|
6787
6818
|
} catch (err) {
|
|
6788
6819
|
if (!isUnknownMethodError(err)) {
|
|
6789
6820
|
throw err;
|
|
@@ -6963,7 +6994,11 @@ async function sendKeyEvent(keycode, metastate) {
|
|
|
6963
6994
|
throw new Error("The `sendKeyEvent` command is only available for Android.");
|
|
6964
6995
|
}
|
|
6965
6996
|
try {
|
|
6966
|
-
|
|
6997
|
+
const args = { keycode: parseInt(keycode, 10) };
|
|
6998
|
+
if (metastate !== void 0) {
|
|
6999
|
+
args.metastate = parseInt(metastate, 10);
|
|
7000
|
+
}
|
|
7001
|
+
return await browser.execute("mobile: pressKey", args);
|
|
6967
7002
|
} catch (err) {
|
|
6968
7003
|
if (!isUnknownMethodError(err)) {
|
|
6969
7004
|
throw err;
|
|
@@ -6974,7 +7009,7 @@ async function sendKeyEvent(keycode, metastate) {
|
|
|
6974
7009
|
}
|
|
6975
7010
|
|
|
6976
7011
|
// src/commands/mobile/startActivity.ts
|
|
6977
|
-
async function startActivity(
|
|
7012
|
+
async function startActivity(appPackageOrOptions, appActivity, appWaitPackage, appWaitActivity, intentAction, intentCategory, intentFlags, optionalIntentArguments, dontStopAppOnReset) {
|
|
6978
7013
|
const browser = this;
|
|
6979
7014
|
if (!browser.isMobile) {
|
|
6980
7015
|
throw new Error("The `startActivity` command is only available for mobile platforms.");
|
|
@@ -6982,33 +7017,49 @@ async function startActivity(appPackage, appActivity, appWaitPackage, appWaitAct
|
|
|
6982
7017
|
if (!browser.isAndroid) {
|
|
6983
7018
|
throw new Error("The `startActivity` command is only available for Android.");
|
|
6984
7019
|
}
|
|
7020
|
+
const opts = typeof appPackageOrOptions === "object" ? appPackageOrOptions : {
|
|
7021
|
+
appPackage: appPackageOrOptions,
|
|
7022
|
+
appActivity,
|
|
7023
|
+
appWaitPackage,
|
|
7024
|
+
appWaitActivity,
|
|
7025
|
+
intentAction,
|
|
7026
|
+
intentCategory,
|
|
7027
|
+
intentFlags,
|
|
7028
|
+
optionalIntentArguments,
|
|
7029
|
+
dontStopAppOnReset
|
|
7030
|
+
};
|
|
7031
|
+
const mobileArgs = {
|
|
7032
|
+
component: "".concat(opts.appPackage, "/").concat(opts.appActivity)
|
|
7033
|
+
};
|
|
7034
|
+
if (opts.intentAction !== void 0) {
|
|
7035
|
+
mobileArgs.action = opts.intentAction;
|
|
7036
|
+
}
|
|
7037
|
+
if (opts.intentCategory !== void 0) {
|
|
7038
|
+
mobileArgs.categories = opts.intentCategory;
|
|
7039
|
+
}
|
|
7040
|
+
if (opts.intentFlags !== void 0) {
|
|
7041
|
+
mobileArgs.flags = opts.intentFlags;
|
|
7042
|
+
}
|
|
7043
|
+
if (opts.dontStopAppOnReset !== void 0) {
|
|
7044
|
+
mobileArgs.stop = opts.dontStopAppOnReset !== "true";
|
|
7045
|
+
}
|
|
6985
7046
|
try {
|
|
6986
|
-
return await browser.execute("mobile: startActivity",
|
|
6987
|
-
appPackage,
|
|
6988
|
-
appActivity,
|
|
6989
|
-
appWaitPackage,
|
|
6990
|
-
appWaitActivity,
|
|
6991
|
-
intentAction,
|
|
6992
|
-
intentCategory,
|
|
6993
|
-
intentFlags,
|
|
6994
|
-
optionalIntentArguments,
|
|
6995
|
-
dontStopAppOnReset
|
|
6996
|
-
});
|
|
7047
|
+
return await browser.execute("mobile: startActivity", mobileArgs);
|
|
6997
7048
|
} catch (err) {
|
|
6998
7049
|
if (!isUnknownMethodError(err)) {
|
|
6999
7050
|
throw err;
|
|
7000
7051
|
}
|
|
7001
7052
|
logAppiumDeprecationWarning("mobile: startActivity", "/appium/device/start_activity");
|
|
7002
7053
|
return browser.appiumStartActivity(
|
|
7003
|
-
appPackage,
|
|
7004
|
-
appActivity,
|
|
7005
|
-
appWaitPackage,
|
|
7006
|
-
appWaitActivity,
|
|
7007
|
-
intentAction,
|
|
7008
|
-
intentCategory,
|
|
7009
|
-
intentFlags,
|
|
7010
|
-
optionalIntentArguments,
|
|
7011
|
-
dontStopAppOnReset
|
|
7054
|
+
opts.appPackage,
|
|
7055
|
+
opts.appActivity,
|
|
7056
|
+
opts.appWaitPackage,
|
|
7057
|
+
opts.appWaitActivity,
|
|
7058
|
+
opts.intentAction,
|
|
7059
|
+
opts.intentCategory,
|
|
7060
|
+
opts.intentFlags,
|
|
7061
|
+
opts.optionalIntentArguments,
|
|
7062
|
+
opts.dontStopAppOnReset
|
|
7012
7063
|
);
|
|
7013
7064
|
}
|
|
7014
7065
|
}
|
|
@@ -7109,7 +7160,7 @@ async function gsmSignal(signalStrength) {
|
|
|
7109
7160
|
throw err;
|
|
7110
7161
|
}
|
|
7111
7162
|
logAppiumDeprecationWarning("mobile: gsmSignal", "/appium/device/gsm_signal");
|
|
7112
|
-
return browser.appiumGsmSignal(signalStrength);
|
|
7163
|
+
return browser.appiumGsmSignal(String(signalStrength));
|
|
7113
7164
|
}
|
|
7114
7165
|
}
|
|
7115
7166
|
|
package/build/node.js
CHANGED
|
@@ -6507,7 +6507,7 @@ async function relaunchActiveApp() {
|
|
|
6507
6507
|
}
|
|
6508
6508
|
|
|
6509
6509
|
// src/commands/mobile/deepLink.ts
|
|
6510
|
-
async function deepLink(link, appIdentifier) {
|
|
6510
|
+
async function deepLink(link, appIdentifier, waitForLaunch) {
|
|
6511
6511
|
const browser = this;
|
|
6512
6512
|
if (!browser.isMobile) {
|
|
6513
6513
|
throw new Error("The `deepLink` command is only available for mobile platforms.");
|
|
@@ -6520,10 +6520,14 @@ async function deepLink(link, appIdentifier) {
|
|
|
6520
6520
|
const identifierValue = browser.isIOS ? "bundleId" : "package";
|
|
6521
6521
|
throw new Error(`When using a deep link URL for ${mobileOS}, you need to provide the \`${identifierValue}\` of the app that the deep link should open.`);
|
|
6522
6522
|
}
|
|
6523
|
-
|
|
6523
|
+
const args = {
|
|
6524
6524
|
url: link,
|
|
6525
6525
|
[browser.isIOS ? "bundleId" : "package"]: appIdentifier
|
|
6526
|
-
}
|
|
6526
|
+
};
|
|
6527
|
+
if (!browser.isIOS && waitForLaunch !== void 0) {
|
|
6528
|
+
args.waitForLaunch = waitForLaunch;
|
|
6529
|
+
}
|
|
6530
|
+
return browser.execute("mobile:deepLink", args);
|
|
6527
6531
|
}
|
|
6528
6532
|
function isDeepLinkUrl(link) {
|
|
6529
6533
|
const deepLinkRegex = /^(?!https?:\/\/)[a-zA-Z][\w+\-.]*:\/\//;
|
|
@@ -6548,7 +6552,7 @@ async function lock(seconds) {
|
|
|
6548
6552
|
}
|
|
6549
6553
|
|
|
6550
6554
|
// src/commands/mobile/touchId.ts
|
|
6551
|
-
async function touchId(match) {
|
|
6555
|
+
async function touchId(match, type = "touchId") {
|
|
6552
6556
|
const browser = this;
|
|
6553
6557
|
if (!browser.isMobile) {
|
|
6554
6558
|
throw new Error("The `touchId` command is only available for mobile platforms.");
|
|
@@ -6557,7 +6561,7 @@ async function touchId(match) {
|
|
|
6557
6561
|
throw new Error("The `touchId` command is only available for iOS. For Android, use `fingerPrint` instead.");
|
|
6558
6562
|
}
|
|
6559
6563
|
try {
|
|
6560
|
-
return await browser.execute("mobile: sendBiometricMatch", { match });
|
|
6564
|
+
return await browser.execute("mobile: sendBiometricMatch", { match, type });
|
|
6561
6565
|
} catch (err) {
|
|
6562
6566
|
if (!isUnknownMethodError(err)) {
|
|
6563
6567
|
throw err;
|
|
@@ -6588,14 +6592,30 @@ async function toggleEnrollTouchId(enabled) {
|
|
|
6588
6592
|
}
|
|
6589
6593
|
|
|
6590
6594
|
// src/commands/mobile/launchApp.ts
|
|
6591
|
-
async function launchApp() {
|
|
6595
|
+
async function launchApp(options) {
|
|
6592
6596
|
const browser = this;
|
|
6593
6597
|
if (!browser.isMobile) {
|
|
6594
6598
|
throw new Error("The `launchApp` command is only available for mobile platforms.");
|
|
6595
6599
|
}
|
|
6596
|
-
|
|
6600
|
+
let mobileCmd;
|
|
6601
|
+
let mobileArgs;
|
|
6602
|
+
if (browser.isIOS) {
|
|
6603
|
+
mobileCmd = "mobile: launchApp";
|
|
6604
|
+
const bundleId = options?.bundleId ?? (await browser.execute("mobile: activeAppInfo")).bundleId;
|
|
6605
|
+
mobileArgs = { bundleId };
|
|
6606
|
+
if (options?.arguments !== void 0) {
|
|
6607
|
+
mobileArgs.arguments = options.arguments;
|
|
6608
|
+
}
|
|
6609
|
+
if (options?.environment !== void 0) {
|
|
6610
|
+
mobileArgs.environment = options.environment;
|
|
6611
|
+
}
|
|
6612
|
+
} else {
|
|
6613
|
+
mobileCmd = "mobile: activateApp";
|
|
6614
|
+
const appId = options?.appId ?? await browser.getCurrentPackage();
|
|
6615
|
+
mobileArgs = { appId };
|
|
6616
|
+
}
|
|
6597
6617
|
try {
|
|
6598
|
-
return await browser.execute(mobileCmd,
|
|
6618
|
+
return await browser.execute(mobileCmd, mobileArgs);
|
|
6599
6619
|
} catch (err) {
|
|
6600
6620
|
if (!isUnknownMethodError(err)) {
|
|
6601
6621
|
throw err;
|
|
@@ -6751,13 +6771,14 @@ async function toggleWiFi(enabled) {
|
|
|
6751
6771
|
}
|
|
6752
6772
|
|
|
6753
6773
|
// src/commands/mobile/unlock.ts
|
|
6754
|
-
async function unlock() {
|
|
6774
|
+
async function unlock(options) {
|
|
6755
6775
|
const browser = this;
|
|
6756
6776
|
if (!browser.isMobile) {
|
|
6757
6777
|
throw new Error("The `unlock` command is only available for mobile platforms.");
|
|
6758
6778
|
}
|
|
6779
|
+
const args = browser.isAndroid && options ? { ...options } : {};
|
|
6759
6780
|
try {
|
|
6760
|
-
return await browser.execute("mobile: unlock",
|
|
6781
|
+
return await browser.execute("mobile: unlock", args);
|
|
6761
6782
|
} catch (err) {
|
|
6762
6783
|
if (!isUnknownMethodError(err)) {
|
|
6763
6784
|
throw err;
|
|
@@ -6805,13 +6826,21 @@ async function shake() {
|
|
|
6805
6826
|
}
|
|
6806
6827
|
|
|
6807
6828
|
// src/commands/mobile/closeApp.ts
|
|
6808
|
-
async function closeApp() {
|
|
6829
|
+
async function closeApp(options) {
|
|
6809
6830
|
const browser = this;
|
|
6810
6831
|
if (!browser.isMobile) {
|
|
6811
6832
|
throw new Error("The `closeApp` command is only available for mobile platforms.");
|
|
6812
6833
|
}
|
|
6834
|
+
let terminateArgs;
|
|
6835
|
+
if (browser.isIOS) {
|
|
6836
|
+
const bundleId = options?.bundleId ?? (await browser.execute("mobile: activeAppInfo")).bundleId;
|
|
6837
|
+
terminateArgs = { bundleId };
|
|
6838
|
+
} else {
|
|
6839
|
+
const appId = options?.appId ?? await browser.getCurrentPackage();
|
|
6840
|
+
terminateArgs = { appId };
|
|
6841
|
+
}
|
|
6813
6842
|
try {
|
|
6814
|
-
return await browser.execute("mobile: terminateApp",
|
|
6843
|
+
return await browser.execute("mobile: terminateApp", terminateArgs);
|
|
6815
6844
|
} catch (err) {
|
|
6816
6845
|
if (!isUnknownMethodError(err)) {
|
|
6817
6846
|
throw err;
|
|
@@ -6991,7 +7020,11 @@ async function sendKeyEvent(keycode, metastate) {
|
|
|
6991
7020
|
throw new Error("The `sendKeyEvent` command is only available for Android.");
|
|
6992
7021
|
}
|
|
6993
7022
|
try {
|
|
6994
|
-
|
|
7023
|
+
const args = { keycode: parseInt(keycode, 10) };
|
|
7024
|
+
if (metastate !== void 0) {
|
|
7025
|
+
args.metastate = parseInt(metastate, 10);
|
|
7026
|
+
}
|
|
7027
|
+
return await browser.execute("mobile: pressKey", args);
|
|
6995
7028
|
} catch (err) {
|
|
6996
7029
|
if (!isUnknownMethodError(err)) {
|
|
6997
7030
|
throw err;
|
|
@@ -7002,7 +7035,7 @@ async function sendKeyEvent(keycode, metastate) {
|
|
|
7002
7035
|
}
|
|
7003
7036
|
|
|
7004
7037
|
// src/commands/mobile/startActivity.ts
|
|
7005
|
-
async function startActivity(
|
|
7038
|
+
async function startActivity(appPackageOrOptions, appActivity, appWaitPackage, appWaitActivity, intentAction, intentCategory, intentFlags, optionalIntentArguments, dontStopAppOnReset) {
|
|
7006
7039
|
const browser = this;
|
|
7007
7040
|
if (!browser.isMobile) {
|
|
7008
7041
|
throw new Error("The `startActivity` command is only available for mobile platforms.");
|
|
@@ -7010,33 +7043,49 @@ async function startActivity(appPackage, appActivity, appWaitPackage, appWaitAct
|
|
|
7010
7043
|
if (!browser.isAndroid) {
|
|
7011
7044
|
throw new Error("The `startActivity` command is only available for Android.");
|
|
7012
7045
|
}
|
|
7046
|
+
const opts = typeof appPackageOrOptions === "object" ? appPackageOrOptions : {
|
|
7047
|
+
appPackage: appPackageOrOptions,
|
|
7048
|
+
appActivity,
|
|
7049
|
+
appWaitPackage,
|
|
7050
|
+
appWaitActivity,
|
|
7051
|
+
intentAction,
|
|
7052
|
+
intentCategory,
|
|
7053
|
+
intentFlags,
|
|
7054
|
+
optionalIntentArguments,
|
|
7055
|
+
dontStopAppOnReset
|
|
7056
|
+
};
|
|
7057
|
+
const mobileArgs = {
|
|
7058
|
+
component: `${opts.appPackage}/${opts.appActivity}`
|
|
7059
|
+
};
|
|
7060
|
+
if (opts.intentAction !== void 0) {
|
|
7061
|
+
mobileArgs.action = opts.intentAction;
|
|
7062
|
+
}
|
|
7063
|
+
if (opts.intentCategory !== void 0) {
|
|
7064
|
+
mobileArgs.categories = opts.intentCategory;
|
|
7065
|
+
}
|
|
7066
|
+
if (opts.intentFlags !== void 0) {
|
|
7067
|
+
mobileArgs.flags = opts.intentFlags;
|
|
7068
|
+
}
|
|
7069
|
+
if (opts.dontStopAppOnReset !== void 0) {
|
|
7070
|
+
mobileArgs.stop = opts.dontStopAppOnReset !== "true";
|
|
7071
|
+
}
|
|
7013
7072
|
try {
|
|
7014
|
-
return await browser.execute("mobile: startActivity",
|
|
7015
|
-
appPackage,
|
|
7016
|
-
appActivity,
|
|
7017
|
-
appWaitPackage,
|
|
7018
|
-
appWaitActivity,
|
|
7019
|
-
intentAction,
|
|
7020
|
-
intentCategory,
|
|
7021
|
-
intentFlags,
|
|
7022
|
-
optionalIntentArguments,
|
|
7023
|
-
dontStopAppOnReset
|
|
7024
|
-
});
|
|
7073
|
+
return await browser.execute("mobile: startActivity", mobileArgs);
|
|
7025
7074
|
} catch (err) {
|
|
7026
7075
|
if (!isUnknownMethodError(err)) {
|
|
7027
7076
|
throw err;
|
|
7028
7077
|
}
|
|
7029
7078
|
logAppiumDeprecationWarning("mobile: startActivity", "/appium/device/start_activity");
|
|
7030
7079
|
return browser.appiumStartActivity(
|
|
7031
|
-
appPackage,
|
|
7032
|
-
appActivity,
|
|
7033
|
-
appWaitPackage,
|
|
7034
|
-
appWaitActivity,
|
|
7035
|
-
intentAction,
|
|
7036
|
-
intentCategory,
|
|
7037
|
-
intentFlags,
|
|
7038
|
-
optionalIntentArguments,
|
|
7039
|
-
dontStopAppOnReset
|
|
7080
|
+
opts.appPackage,
|
|
7081
|
+
opts.appActivity,
|
|
7082
|
+
opts.appWaitPackage,
|
|
7083
|
+
opts.appWaitActivity,
|
|
7084
|
+
opts.intentAction,
|
|
7085
|
+
opts.intentCategory,
|
|
7086
|
+
opts.intentFlags,
|
|
7087
|
+
opts.optionalIntentArguments,
|
|
7088
|
+
opts.dontStopAppOnReset
|
|
7040
7089
|
);
|
|
7041
7090
|
}
|
|
7042
7091
|
}
|
|
@@ -7137,7 +7186,7 @@ async function gsmSignal(signalStrength) {
|
|
|
7137
7186
|
throw err;
|
|
7138
7187
|
}
|
|
7139
7188
|
logAppiumDeprecationWarning("mobile: gsmSignal", "/appium/device/gsm_signal");
|
|
7140
|
-
return browser.appiumGsmSignal(signalStrength);
|
|
7189
|
+
return browser.appiumGsmSignal(String(signalStrength));
|
|
7141
7190
|
}
|
|
7142
7191
|
}
|
|
7143
7192
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webdriverio",
|
|
3
3
|
"description": "Next-gen browser and mobile automation test framework for Node.js",
|
|
4
|
-
"version": "9.26.
|
|
4
|
+
"version": "9.26.1",
|
|
5
5
|
"homepage": "https://webdriver.io",
|
|
6
6
|
"author": "Christian Bromann <mail@bromann.dev>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -77,12 +77,12 @@
|
|
|
77
77
|
"dependencies": {
|
|
78
78
|
"@types/node": "^20.11.30",
|
|
79
79
|
"@types/sinonjs__fake-timers": "^8.1.5",
|
|
80
|
-
"@wdio/config": "9.26.
|
|
80
|
+
"@wdio/config": "9.26.1",
|
|
81
81
|
"@wdio/logger": "9.18.0",
|
|
82
|
-
"@wdio/protocols": "9.26.
|
|
82
|
+
"@wdio/protocols": "9.26.1",
|
|
83
83
|
"@wdio/repl": "9.16.2",
|
|
84
|
-
"@wdio/types": "9.26.
|
|
85
|
-
"@wdio/utils": "9.26.
|
|
84
|
+
"@wdio/types": "9.26.1",
|
|
85
|
+
"@wdio/utils": "9.26.1",
|
|
86
86
|
"archiver": "^7.0.1",
|
|
87
87
|
"aria-query": "^5.3.0",
|
|
88
88
|
"cheerio": "^1.0.0-rc.12",
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"rgb2hex": "0.2.5",
|
|
100
100
|
"serialize-error": "^12.0.0",
|
|
101
101
|
"urlpattern-polyfill": "^10.0.0",
|
|
102
|
-
"webdriver": "9.26.
|
|
102
|
+
"webdriver": "9.26.1"
|
|
103
103
|
},
|
|
104
104
|
"peerDependencies": {
|
|
105
105
|
"puppeteer-core": ">=22.x || <=24.x"
|
|
@@ -109,5 +109,5 @@
|
|
|
109
109
|
"optional": true
|
|
110
110
|
}
|
|
111
111
|
},
|
|
112
|
-
"gitHead": "
|
|
112
|
+
"gitHead": "0149a736235a2fb00f84a50652193bb92c24cd8f"
|
|
113
113
|
}
|