webdriverio 9.26.0 → 9.27.0

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.
@@ -60,7 +60,6 @@ export * from './mobile/background.js';
60
60
  export * from './mobile/getStrings.js';
61
61
  export * from './mobile/setClipboard.js';
62
62
  export * from './mobile/getClipboard.js';
63
- export * from './mobile/queryAppState.js';
64
63
  export * from './mobile/toggleAirplaneMode.js';
65
64
  export * from './mobile/toggleData.js';
66
65
  export * from './mobile/toggleWiFi.js';
@@ -1 +1 @@
1
- {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/commands/browser.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA;AACpC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,mBAAmB,CAAA;AACjC,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA;AACpC,cAAc,oBAAoB,CAAA;AAClC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,2BAA2B,CAAA;AACzC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,2BAA2B,CAAA;AACzC,cAAc,yBAAyB,CAAA;AACvC,cAAc,2BAA2B,CAAA;AACzC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,2BAA2B,CAAA;AACzC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,wBAAwB,CAAA;AACtC,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,kCAAkC,CAAA;AAChD,cAAc,6BAA6B,CAAA;AAC3C,cAAc,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AA;AAClD,cAAc,gCAAgC,CAAA;AAC9C,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,yBAAyB,CAAA;AACvC,cAAc,2BAA2B,CAAA;AACzC,cAAc,qBAAqB,CAAA"}
@@ -1,17 +1,35 @@
1
1
  /**
2
2
  *
3
- * Close the currently open app on the device.
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 current app', async () => {
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): Promise<unknown>;
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;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,QAAQ,CAC1B,IAAI,EAAE,WAAW,CAAC,OAAO,oBAkB5B"}
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} 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.
20
- * @param {string} appIdentifier The value of the `package` (Android) or `bundleId` (iOS) of the app that the deep link should open.
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;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,QAAQ,CAC1B,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,IAAI,EAAE,MAAM,EACZ,aAAa,EAAE,MAAM,oBAuBxB"}
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. Value must be in range [0, 4] where 0 is
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('4')
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 {string} signalStrength The signal strength to set (0–4, where 0 is none and 4 is full)
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: string): Promise<unknown>;
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;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,SAAS,CAC3B,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,cAAc,EAAE,MAAM,oBAsBzB"}
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 the app configured in the current session capabilities.
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 the app', async () => {
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): Promise<unknown>;
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;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,SAAS,CAC3B,IAAI,EAAE,WAAW,CAAC,OAAO,oBAoB5B"}
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] Meta state to press the keycode with (e.g. '1' for Shift)
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;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,YAAY,CAC9B,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,OAAO,EAAE,MAAM,EACf,SAAS,CAAC,EAAE,MAAM,oBAqBrB"}
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
- // Start a specific activity
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
- // Start activity and wait for another to appear
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} appPackage The package name of the app to start
18
- * @param {string} appActivity The activity name to start
19
- * @param {string} [appWaitPackage] The package name to wait for after starting the activity
20
- * @param {string} [appWaitActivity] The activity name to wait for after starting the activity
21
- * @param {string} [intentAction] The intent action to use to start the activity
22
- * @param {string} [intentCategory] The intent category to use to start the activity
23
- * @param {string} [intentFlags] Flags to use when starting the activity
24
- * @param {string} [optionalIntentArguments] Additional intent arguments to use when starting the activity
25
- * @param {string} [dontStopAppOnReset] Whether to stop the app before starting the activity
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, appPackage: string, appActivity: string, appWaitPackage?: string, appWaitActivity?: string, intentAction?: string, intentCategory?: string, intentFlags?: string, optionalIntentArguments?: string, dontStopAppOnReset?: string): Promise<unknown>;
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;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,aAAa,CAC/B,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,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,oBA0C9B"}
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 fingerprint match event on iOS Simulator.
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 fingerprint match
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 fingerprint match
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 fingerprint match should succeed (`true`) or fail (`false`)
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;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,OAAO,CACzB,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,KAAK,EAAE,OAAO,oBAsBjB"}
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): Promise<unknown>;
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;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,MAAM,CACxB,IAAI,EAAE,WAAW,CAAC,OAAO,oBAkB5B"}
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"}
@@ -15,7 +15,6 @@ export * from './mobile/background.js';
15
15
  export * from './mobile/getStrings.js';
16
16
  export * from './mobile/setClipboard.js';
17
17
  export * from './mobile/getClipboard.js';
18
- export * from './mobile/queryAppState.js';
19
18
  export * from './mobile/toggleAirplaneMode.js';
20
19
  export * from './mobile/toggleData.js';
21
20
  export * from './mobile/toggleWiFi.js';
@@ -1 +1 @@
1
- {"version":3,"file":"mobile.d.ts","sourceRoot":"","sources":["../../src/commands/mobile.ts"],"names":[],"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
package/build/index.js CHANGED
@@ -154,7 +154,6 @@ __export(browser_exports, {
154
154
  powerAC: () => powerAC,
155
155
  powerCapacity: () => powerCapacity,
156
156
  pressKeyCode: () => pressKeyCode,
157
- queryAppState: () => queryAppState,
158
157
  react$: () => react$3,
159
158
  react$$: () => react$$3,
160
159
  relaunchActiveApp: () => relaunchActiveApp,
@@ -6479,7 +6478,7 @@ async function relaunchActiveApp() {
6479
6478
  }
6480
6479
 
6481
6480
  // src/commands/mobile/deepLink.ts
6482
- async function deepLink(link, appIdentifier) {
6481
+ async function deepLink(link, appIdentifier, waitForLaunch) {
6483
6482
  const browser = this;
6484
6483
  if (!browser.isMobile) {
6485
6484
  throw new Error("The `deepLink` command is only available for mobile platforms.");
@@ -6492,10 +6491,14 @@ async function deepLink(link, appIdentifier) {
6492
6491
  const identifierValue = browser.isIOS ? "bundleId" : "package";
6493
6492
  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
6493
  }
6495
- return browser.execute("mobile:deepLink", {
6494
+ const args = {
6496
6495
  url: link,
6497
6496
  [browser.isIOS ? "bundleId" : "package"]: appIdentifier
6498
- });
6497
+ };
6498
+ if (!browser.isIOS && waitForLaunch !== void 0) {
6499
+ args.waitForLaunch = waitForLaunch;
6500
+ }
6501
+ return browser.execute("mobile:deepLink", args);
6499
6502
  }
6500
6503
  function isDeepLinkUrl(link) {
6501
6504
  const deepLinkRegex = /^(?!https?:\/\/)[a-zA-Z][\w+\-.]*:\/\//;
@@ -6520,7 +6523,7 @@ async function lock(seconds) {
6520
6523
  }
6521
6524
 
6522
6525
  // src/commands/mobile/touchId.ts
6523
- async function touchId(match) {
6526
+ async function touchId(match, type = "touchId") {
6524
6527
  const browser = this;
6525
6528
  if (!browser.isMobile) {
6526
6529
  throw new Error("The `touchId` command is only available for mobile platforms.");
@@ -6529,7 +6532,7 @@ async function touchId(match) {
6529
6532
  throw new Error("The `touchId` command is only available for iOS. For Android, use `fingerPrint` instead.");
6530
6533
  }
6531
6534
  try {
6532
- return await browser.execute("mobile: sendBiometricMatch", { match });
6535
+ return await browser.execute("mobile: sendBiometricMatch", { match, type });
6533
6536
  } catch (err) {
6534
6537
  if (!isUnknownMethodError(err)) {
6535
6538
  throw err;
@@ -6560,14 +6563,31 @@ async function toggleEnrollTouchId(enabled) {
6560
6563
  }
6561
6564
 
6562
6565
  // src/commands/mobile/launchApp.ts
6563
- async function launchApp() {
6566
+ async function launchApp(options) {
6567
+ var _a, _b;
6564
6568
  const browser = this;
6565
6569
  if (!browser.isMobile) {
6566
6570
  throw new Error("The `launchApp` command is only available for mobile platforms.");
6567
6571
  }
6568
- const mobileCmd = browser.isIOS ? "mobile: launchApp" : "mobile: activateApp";
6572
+ let mobileCmd;
6573
+ let mobileArgs;
6574
+ if (browser.isIOS) {
6575
+ mobileCmd = "mobile: launchApp";
6576
+ const bundleId = (_a = options == null ? void 0 : options.bundleId) != null ? _a : (await browser.execute("mobile: activeAppInfo")).bundleId;
6577
+ mobileArgs = { bundleId };
6578
+ if ((options == null ? void 0 : options.arguments) !== void 0) {
6579
+ mobileArgs.arguments = options.arguments;
6580
+ }
6581
+ if ((options == null ? void 0 : options.environment) !== void 0) {
6582
+ mobileArgs.environment = options.environment;
6583
+ }
6584
+ } else {
6585
+ mobileCmd = "mobile: activateApp";
6586
+ const appId = (_b = options == null ? void 0 : options.appId) != null ? _b : await browser.getCurrentPackage();
6587
+ mobileArgs = { appId };
6588
+ }
6569
6589
  try {
6570
- return await browser.execute(mobileCmd, {});
6590
+ return await browser.execute(mobileCmd, mobileArgs);
6571
6591
  } catch (err) {
6572
6592
  if (!isUnknownMethodError(err)) {
6573
6593
  throw err;
@@ -6645,23 +6665,6 @@ async function getClipboard(contentType) {
6645
6665
  }
6646
6666
  }
6647
6667
 
6648
- // src/commands/mobile/queryAppState.ts
6649
- async function queryAppState(appId, bundleId) {
6650
- const browser = this;
6651
- if (!browser.isMobile) {
6652
- throw new Error("The `queryAppState` command is only available for mobile platforms.");
6653
- }
6654
- try {
6655
- return await browser.execute("mobile: queryAppState", { appId, bundleId });
6656
- } catch (err) {
6657
- if (!isUnknownMethodError(err)) {
6658
- throw err;
6659
- }
6660
- logAppiumDeprecationWarning("mobile: queryAppState", "/appium/device/app_state");
6661
- return browser.appiumQueryAppState(appId, bundleId);
6662
- }
6663
- }
6664
-
6665
6668
  // src/commands/mobile/toggleAirplaneMode.ts
6666
6669
  async function toggleAirplaneMode(enabled) {
6667
6670
  const browser = this;
@@ -6723,13 +6726,14 @@ async function toggleWiFi(enabled) {
6723
6726
  }
6724
6727
 
6725
6728
  // src/commands/mobile/unlock.ts
6726
- async function unlock() {
6729
+ async function unlock(options) {
6727
6730
  const browser = this;
6728
6731
  if (!browser.isMobile) {
6729
6732
  throw new Error("The `unlock` command is only available for mobile platforms.");
6730
6733
  }
6734
+ const args = browser.isAndroid && options ? { ...options } : {};
6731
6735
  try {
6732
- return await browser.execute("mobile: unlock", {});
6736
+ return await browser.execute("mobile: unlock", args);
6733
6737
  } catch (err) {
6734
6738
  if (!isUnknownMethodError(err)) {
6735
6739
  throw err;
@@ -6777,13 +6781,22 @@ async function shake() {
6777
6781
  }
6778
6782
 
6779
6783
  // src/commands/mobile/closeApp.ts
6780
- async function closeApp() {
6784
+ async function closeApp(options) {
6785
+ var _a, _b;
6781
6786
  const browser = this;
6782
6787
  if (!browser.isMobile) {
6783
6788
  throw new Error("The `closeApp` command is only available for mobile platforms.");
6784
6789
  }
6790
+ let terminateArgs;
6791
+ if (browser.isIOS) {
6792
+ const bundleId = (_a = options == null ? void 0 : options.bundleId) != null ? _a : (await browser.execute("mobile: activeAppInfo")).bundleId;
6793
+ terminateArgs = { bundleId };
6794
+ } else {
6795
+ const appId = (_b = options == null ? void 0 : options.appId) != null ? _b : await browser.getCurrentPackage();
6796
+ terminateArgs = { appId };
6797
+ }
6785
6798
  try {
6786
- return await browser.execute("mobile: terminateApp", {});
6799
+ return await browser.execute("mobile: terminateApp", terminateArgs);
6787
6800
  } catch (err) {
6788
6801
  if (!isUnknownMethodError(err)) {
6789
6802
  throw err;
@@ -6963,7 +6976,11 @@ async function sendKeyEvent(keycode, metastate) {
6963
6976
  throw new Error("The `sendKeyEvent` command is only available for Android.");
6964
6977
  }
6965
6978
  try {
6966
- return await browser.execute("mobile: pressKey", { keycode, metastate });
6979
+ const args = { keycode: parseInt(keycode, 10) };
6980
+ if (metastate !== void 0) {
6981
+ args.metastate = parseInt(metastate, 10);
6982
+ }
6983
+ return await browser.execute("mobile: pressKey", args);
6967
6984
  } catch (err) {
6968
6985
  if (!isUnknownMethodError(err)) {
6969
6986
  throw err;
@@ -6974,7 +6991,7 @@ async function sendKeyEvent(keycode, metastate) {
6974
6991
  }
6975
6992
 
6976
6993
  // src/commands/mobile/startActivity.ts
6977
- async function startActivity(appPackage, appActivity, appWaitPackage, appWaitActivity, intentAction, intentCategory, intentFlags, optionalIntentArguments, dontStopAppOnReset) {
6994
+ async function startActivity(appPackageOrOptions, appActivity, appWaitPackage, appWaitActivity, intentAction, intentCategory, intentFlags, optionalIntentArguments, dontStopAppOnReset) {
6978
6995
  const browser = this;
6979
6996
  if (!browser.isMobile) {
6980
6997
  throw new Error("The `startActivity` command is only available for mobile platforms.");
@@ -6982,33 +6999,49 @@ async function startActivity(appPackage, appActivity, appWaitPackage, appWaitAct
6982
6999
  if (!browser.isAndroid) {
6983
7000
  throw new Error("The `startActivity` command is only available for Android.");
6984
7001
  }
7002
+ const opts = typeof appPackageOrOptions === "object" ? appPackageOrOptions : {
7003
+ appPackage: appPackageOrOptions,
7004
+ appActivity,
7005
+ appWaitPackage,
7006
+ appWaitActivity,
7007
+ intentAction,
7008
+ intentCategory,
7009
+ intentFlags,
7010
+ optionalIntentArguments,
7011
+ dontStopAppOnReset
7012
+ };
7013
+ const mobileArgs = {
7014
+ component: "".concat(opts.appPackage, "/").concat(opts.appActivity)
7015
+ };
7016
+ if (opts.intentAction !== void 0) {
7017
+ mobileArgs.action = opts.intentAction;
7018
+ }
7019
+ if (opts.intentCategory !== void 0) {
7020
+ mobileArgs.categories = opts.intentCategory;
7021
+ }
7022
+ if (opts.intentFlags !== void 0) {
7023
+ mobileArgs.flags = opts.intentFlags;
7024
+ }
7025
+ if (opts.dontStopAppOnReset !== void 0) {
7026
+ mobileArgs.stop = opts.dontStopAppOnReset !== "true";
7027
+ }
6985
7028
  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
- });
7029
+ return await browser.execute("mobile: startActivity", mobileArgs);
6997
7030
  } catch (err) {
6998
7031
  if (!isUnknownMethodError(err)) {
6999
7032
  throw err;
7000
7033
  }
7001
7034
  logAppiumDeprecationWarning("mobile: startActivity", "/appium/device/start_activity");
7002
7035
  return browser.appiumStartActivity(
7003
- appPackage,
7004
- appActivity,
7005
- appWaitPackage,
7006
- appWaitActivity,
7007
- intentAction,
7008
- intentCategory,
7009
- intentFlags,
7010
- optionalIntentArguments,
7011
- dontStopAppOnReset
7036
+ opts.appPackage,
7037
+ opts.appActivity,
7038
+ opts.appWaitPackage,
7039
+ opts.appWaitActivity,
7040
+ opts.intentAction,
7041
+ opts.intentCategory,
7042
+ opts.intentFlags,
7043
+ opts.optionalIntentArguments,
7044
+ opts.dontStopAppOnReset
7012
7045
  );
7013
7046
  }
7014
7047
  }
@@ -7109,7 +7142,7 @@ async function gsmSignal(signalStrength) {
7109
7142
  throw err;
7110
7143
  }
7111
7144
  logAppiumDeprecationWarning("mobile: gsmSignal", "/appium/device/gsm_signal");
7112
- return browser.appiumGsmSignal(signalStrength);
7145
+ return browser.appiumGsmSignal(String(signalStrength));
7113
7146
  }
7114
7147
  }
7115
7148
 
package/build/node.js CHANGED
@@ -760,7 +760,6 @@ __export(browser_exports, {
760
760
  powerAC: () => powerAC,
761
761
  powerCapacity: () => powerCapacity,
762
762
  pressKeyCode: () => pressKeyCode,
763
- queryAppState: () => queryAppState,
764
763
  react$: () => react$,
765
764
  react$$: () => react$$,
766
765
  relaunchActiveApp: () => relaunchActiveApp,
@@ -6507,7 +6506,7 @@ async function relaunchActiveApp() {
6507
6506
  }
6508
6507
 
6509
6508
  // src/commands/mobile/deepLink.ts
6510
- async function deepLink(link, appIdentifier) {
6509
+ async function deepLink(link, appIdentifier, waitForLaunch) {
6511
6510
  const browser = this;
6512
6511
  if (!browser.isMobile) {
6513
6512
  throw new Error("The `deepLink` command is only available for mobile platforms.");
@@ -6520,10 +6519,14 @@ async function deepLink(link, appIdentifier) {
6520
6519
  const identifierValue = browser.isIOS ? "bundleId" : "package";
6521
6520
  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
6521
  }
6523
- return browser.execute("mobile:deepLink", {
6522
+ const args = {
6524
6523
  url: link,
6525
6524
  [browser.isIOS ? "bundleId" : "package"]: appIdentifier
6526
- });
6525
+ };
6526
+ if (!browser.isIOS && waitForLaunch !== void 0) {
6527
+ args.waitForLaunch = waitForLaunch;
6528
+ }
6529
+ return browser.execute("mobile:deepLink", args);
6527
6530
  }
6528
6531
  function isDeepLinkUrl(link) {
6529
6532
  const deepLinkRegex = /^(?!https?:\/\/)[a-zA-Z][\w+\-.]*:\/\//;
@@ -6548,7 +6551,7 @@ async function lock(seconds) {
6548
6551
  }
6549
6552
 
6550
6553
  // src/commands/mobile/touchId.ts
6551
- async function touchId(match) {
6554
+ async function touchId(match, type = "touchId") {
6552
6555
  const browser = this;
6553
6556
  if (!browser.isMobile) {
6554
6557
  throw new Error("The `touchId` command is only available for mobile platforms.");
@@ -6557,7 +6560,7 @@ async function touchId(match) {
6557
6560
  throw new Error("The `touchId` command is only available for iOS. For Android, use `fingerPrint` instead.");
6558
6561
  }
6559
6562
  try {
6560
- return await browser.execute("mobile: sendBiometricMatch", { match });
6563
+ return await browser.execute("mobile: sendBiometricMatch", { match, type });
6561
6564
  } catch (err) {
6562
6565
  if (!isUnknownMethodError(err)) {
6563
6566
  throw err;
@@ -6588,14 +6591,30 @@ async function toggleEnrollTouchId(enabled) {
6588
6591
  }
6589
6592
 
6590
6593
  // src/commands/mobile/launchApp.ts
6591
- async function launchApp() {
6594
+ async function launchApp(options) {
6592
6595
  const browser = this;
6593
6596
  if (!browser.isMobile) {
6594
6597
  throw new Error("The `launchApp` command is only available for mobile platforms.");
6595
6598
  }
6596
- const mobileCmd = browser.isIOS ? "mobile: launchApp" : "mobile: activateApp";
6599
+ let mobileCmd;
6600
+ let mobileArgs;
6601
+ if (browser.isIOS) {
6602
+ mobileCmd = "mobile: launchApp";
6603
+ const bundleId = options?.bundleId ?? (await browser.execute("mobile: activeAppInfo")).bundleId;
6604
+ mobileArgs = { bundleId };
6605
+ if (options?.arguments !== void 0) {
6606
+ mobileArgs.arguments = options.arguments;
6607
+ }
6608
+ if (options?.environment !== void 0) {
6609
+ mobileArgs.environment = options.environment;
6610
+ }
6611
+ } else {
6612
+ mobileCmd = "mobile: activateApp";
6613
+ const appId = options?.appId ?? await browser.getCurrentPackage();
6614
+ mobileArgs = { appId };
6615
+ }
6597
6616
  try {
6598
- return await browser.execute(mobileCmd, {});
6617
+ return await browser.execute(mobileCmd, mobileArgs);
6599
6618
  } catch (err) {
6600
6619
  if (!isUnknownMethodError(err)) {
6601
6620
  throw err;
@@ -6673,23 +6692,6 @@ async function getClipboard(contentType) {
6673
6692
  }
6674
6693
  }
6675
6694
 
6676
- // src/commands/mobile/queryAppState.ts
6677
- async function queryAppState(appId, bundleId) {
6678
- const browser = this;
6679
- if (!browser.isMobile) {
6680
- throw new Error("The `queryAppState` command is only available for mobile platforms.");
6681
- }
6682
- try {
6683
- return await browser.execute("mobile: queryAppState", { appId, bundleId });
6684
- } catch (err) {
6685
- if (!isUnknownMethodError(err)) {
6686
- throw err;
6687
- }
6688
- logAppiumDeprecationWarning("mobile: queryAppState", "/appium/device/app_state");
6689
- return browser.appiumQueryAppState(appId, bundleId);
6690
- }
6691
- }
6692
-
6693
6695
  // src/commands/mobile/toggleAirplaneMode.ts
6694
6696
  async function toggleAirplaneMode(enabled) {
6695
6697
  const browser = this;
@@ -6751,13 +6753,14 @@ async function toggleWiFi(enabled) {
6751
6753
  }
6752
6754
 
6753
6755
  // src/commands/mobile/unlock.ts
6754
- async function unlock() {
6756
+ async function unlock(options) {
6755
6757
  const browser = this;
6756
6758
  if (!browser.isMobile) {
6757
6759
  throw new Error("The `unlock` command is only available for mobile platforms.");
6758
6760
  }
6761
+ const args = browser.isAndroid && options ? { ...options } : {};
6759
6762
  try {
6760
- return await browser.execute("mobile: unlock", {});
6763
+ return await browser.execute("mobile: unlock", args);
6761
6764
  } catch (err) {
6762
6765
  if (!isUnknownMethodError(err)) {
6763
6766
  throw err;
@@ -6805,13 +6808,21 @@ async function shake() {
6805
6808
  }
6806
6809
 
6807
6810
  // src/commands/mobile/closeApp.ts
6808
- async function closeApp() {
6811
+ async function closeApp(options) {
6809
6812
  const browser = this;
6810
6813
  if (!browser.isMobile) {
6811
6814
  throw new Error("The `closeApp` command is only available for mobile platforms.");
6812
6815
  }
6816
+ let terminateArgs;
6817
+ if (browser.isIOS) {
6818
+ const bundleId = options?.bundleId ?? (await browser.execute("mobile: activeAppInfo")).bundleId;
6819
+ terminateArgs = { bundleId };
6820
+ } else {
6821
+ const appId = options?.appId ?? await browser.getCurrentPackage();
6822
+ terminateArgs = { appId };
6823
+ }
6813
6824
  try {
6814
- return await browser.execute("mobile: terminateApp", {});
6825
+ return await browser.execute("mobile: terminateApp", terminateArgs);
6815
6826
  } catch (err) {
6816
6827
  if (!isUnknownMethodError(err)) {
6817
6828
  throw err;
@@ -6991,7 +7002,11 @@ async function sendKeyEvent(keycode, metastate) {
6991
7002
  throw new Error("The `sendKeyEvent` command is only available for Android.");
6992
7003
  }
6993
7004
  try {
6994
- return await browser.execute("mobile: pressKey", { keycode, metastate });
7005
+ const args = { keycode: parseInt(keycode, 10) };
7006
+ if (metastate !== void 0) {
7007
+ args.metastate = parseInt(metastate, 10);
7008
+ }
7009
+ return await browser.execute("mobile: pressKey", args);
6995
7010
  } catch (err) {
6996
7011
  if (!isUnknownMethodError(err)) {
6997
7012
  throw err;
@@ -7002,7 +7017,7 @@ async function sendKeyEvent(keycode, metastate) {
7002
7017
  }
7003
7018
 
7004
7019
  // src/commands/mobile/startActivity.ts
7005
- async function startActivity(appPackage, appActivity, appWaitPackage, appWaitActivity, intentAction, intentCategory, intentFlags, optionalIntentArguments, dontStopAppOnReset) {
7020
+ async function startActivity(appPackageOrOptions, appActivity, appWaitPackage, appWaitActivity, intentAction, intentCategory, intentFlags, optionalIntentArguments, dontStopAppOnReset) {
7006
7021
  const browser = this;
7007
7022
  if (!browser.isMobile) {
7008
7023
  throw new Error("The `startActivity` command is only available for mobile platforms.");
@@ -7010,33 +7025,49 @@ async function startActivity(appPackage, appActivity, appWaitPackage, appWaitAct
7010
7025
  if (!browser.isAndroid) {
7011
7026
  throw new Error("The `startActivity` command is only available for Android.");
7012
7027
  }
7028
+ const opts = typeof appPackageOrOptions === "object" ? appPackageOrOptions : {
7029
+ appPackage: appPackageOrOptions,
7030
+ appActivity,
7031
+ appWaitPackage,
7032
+ appWaitActivity,
7033
+ intentAction,
7034
+ intentCategory,
7035
+ intentFlags,
7036
+ optionalIntentArguments,
7037
+ dontStopAppOnReset
7038
+ };
7039
+ const mobileArgs = {
7040
+ component: `${opts.appPackage}/${opts.appActivity}`
7041
+ };
7042
+ if (opts.intentAction !== void 0) {
7043
+ mobileArgs.action = opts.intentAction;
7044
+ }
7045
+ if (opts.intentCategory !== void 0) {
7046
+ mobileArgs.categories = opts.intentCategory;
7047
+ }
7048
+ if (opts.intentFlags !== void 0) {
7049
+ mobileArgs.flags = opts.intentFlags;
7050
+ }
7051
+ if (opts.dontStopAppOnReset !== void 0) {
7052
+ mobileArgs.stop = opts.dontStopAppOnReset !== "true";
7053
+ }
7013
7054
  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
- });
7055
+ return await browser.execute("mobile: startActivity", mobileArgs);
7025
7056
  } catch (err) {
7026
7057
  if (!isUnknownMethodError(err)) {
7027
7058
  throw err;
7028
7059
  }
7029
7060
  logAppiumDeprecationWarning("mobile: startActivity", "/appium/device/start_activity");
7030
7061
  return browser.appiumStartActivity(
7031
- appPackage,
7032
- appActivity,
7033
- appWaitPackage,
7034
- appWaitActivity,
7035
- intentAction,
7036
- intentCategory,
7037
- intentFlags,
7038
- optionalIntentArguments,
7039
- dontStopAppOnReset
7062
+ opts.appPackage,
7063
+ opts.appActivity,
7064
+ opts.appWaitPackage,
7065
+ opts.appWaitActivity,
7066
+ opts.intentAction,
7067
+ opts.intentCategory,
7068
+ opts.intentFlags,
7069
+ opts.optionalIntentArguments,
7070
+ opts.dontStopAppOnReset
7040
7071
  );
7041
7072
  }
7042
7073
  }
@@ -7137,7 +7168,7 @@ async function gsmSignal(signalStrength) {
7137
7168
  throw err;
7138
7169
  }
7139
7170
  logAppiumDeprecationWarning("mobile: gsmSignal", "/appium/device/gsm_signal");
7140
- return browser.appiumGsmSignal(signalStrength);
7171
+ return browser.appiumGsmSignal(String(signalStrength));
7141
7172
  }
7142
7173
  }
7143
7174
 
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.0",
4
+ "version": "9.27.0",
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.0",
80
+ "@wdio/config": "9.27.0",
81
81
  "@wdio/logger": "9.18.0",
82
- "@wdio/protocols": "9.26.0",
82
+ "@wdio/protocols": "9.27.0",
83
83
  "@wdio/repl": "9.16.2",
84
- "@wdio/types": "9.26.0",
85
- "@wdio/utils": "9.26.0",
84
+ "@wdio/types": "9.27.0",
85
+ "@wdio/utils": "9.27.0",
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.0"
102
+ "webdriver": "9.27.0"
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": "974fb5ead9fe6738af6f5e2306224036de552f33"
112
+ "gitHead": "2a7beb52c6d6f9aa81445a258202c9eb830b1a00"
113
113
  }
@@ -1,32 +0,0 @@
1
- /**
2
- *
3
- * Get the state of a given application on the device.
4
- *
5
- * > **Note:** Falls back to the deprecated Appium 2 protocol endpoint if the driver does not support the `mobile:` execute method.
6
- *
7
- * Returns one of the following numeric states:
8
- * - `0` — Not installed
9
- * - `1` — Not running
10
- * - `2` — Running in background (suspended)
11
- * - `3` — Running in background
12
- * - `4` — Running in foreground
13
- *
14
- * <example>
15
- :queryAppState.js
16
- it('should get the app state', async () => {
17
- // Check app state on Android
18
- const state = await browser.queryAppState('com.example.app')
19
- // Check app state on iOS
20
- const iosState = await browser.queryAppState(undefined, 'com.example.app')
21
- })
22
- * </example>
23
- *
24
- * @param {string} [appId] Application package name (Android).
25
- * @param {string} [bundleId] Application bundle identifier (iOS).
26
- *
27
- * @returns {`Promise<number>`} The application state (0–4).
28
- *
29
- * @support ["ios","android"]
30
- */
31
- export declare function queryAppState(this: WebdriverIO.Browser, appId?: string, bundleId?: string): Promise<number>;
32
- //# sourceMappingURL=queryAppState.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"queryAppState.d.ts","sourceRoot":"","sources":["../../../src/commands/mobile/queryAppState.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAsB,aAAa,CAC/B,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,KAAK,CAAC,EAAE,MAAM,EACd,QAAQ,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,CAAC,CAiBjB"}