obsidian-integration-testing 8.1.2 → 8.2.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.
package/README.md CHANGED
@@ -703,7 +703,7 @@ Runs tests against Obsidian Mobile on an Android emulator or real device via App
703
703
  adb shell appops set md.obsidian MANAGE_EXTERNAL_STORAGE allow
704
704
  ```
705
705
 
706
- 4. Install [Appium](https://appium.io/) and the [UiAutomator2 driver](https://github.com/appium/appium-uiautomator2-driver):
706
+ 4. (Optional) Install [Appium](https://appium.io/) and the [UiAutomator2 driver](https://github.com/appium/appium-uiautomator2-driver):
707
707
 
708
708
  ```bash
709
709
  npm install -g appium
@@ -712,7 +712,7 @@ Runs tests against Obsidian Mobile on an Android emulator or real device via App
712
712
 
713
713
  > [!NOTE]
714
714
  >
715
- > You do not need to start the Appium server manually — the test framework auto-starts it if it is not already running.
715
+ > This step is optional. You do not need to start the Appium server manually — the test framework auto-starts it if it is not already running, and by default it also **auto-installs** Appium (globally) and the UiAutomator2 driver when they are missing. Set `shouldAutoInstallAppiumDependencies: false` to manage the Appium toolchain yourself and skip the global install.
716
716
 
717
717
  5. Configure vitest:
718
718
 
@@ -735,18 +735,19 @@ Runs tests against Obsidian Mobile on an Android emulator or real device via App
735
735
 
736
736
  Besides the required `appiumUrl` and `avdName`, the transport accepts these optional knobs (all with sensible defaults):
737
737
 
738
- | Option | Purpose | Default |
739
- | --------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | ---------------------- |
740
- | `appId` | App package (Android) or bundle ID (iOS). | `'md.obsidian'` |
741
- | `appiumStartTimeoutInMilliseconds` | Max wait for the auto-started Appium server to become ready; only when the harness auto-starts it. | `180000` |
742
- | `deviceIdleTimeoutInMilliseconds` | Max wait after boot for a started emulator to go idle before the session; avoids inflated cold setup. 0 skips. | `60000` |
743
- | `isAppiumConsoleVisible` | Show the auto-started Appium server console window and live output. Hidden and quiet by default. | `false` |
744
- | `isEmulatorVisible` | Show the auto-started emulator window. Hidden (`-no-window`, headless) by default so it never steals focus. | `false` |
745
- | `layoutReadyTimeoutInMilliseconds` | Max wait for `app.workspace.layoutReady` after the vault (re)opens; raise on slow emulators. | `90000` |
746
- | `sessionConnectionRetryTimeoutInMilliseconds` | Max wait to establish the Appium session (UiAutomator2 install + app launch); the dominant startup cost. | `180000` |
747
- | `shouldAutoStartAppium` | Auto-start the Appium server when it is not already reachable. | `true` |
748
- | `vaultBasePath` | Base device path where Obsidian stores vaults. | `'/sdcard/Documents/'` |
749
- | `webviewTimeoutInMilliseconds` | Max wait for the WebView context after the Appium session starts. | `60000` |
738
+ | Option | Purpose | Default |
739
+ | --------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------- |
740
+ | `appId` | App package (Android) or bundle ID (iOS). | `'md.obsidian'` |
741
+ | `appiumStartTimeoutInMilliseconds` | Max wait for the auto-started Appium server to become ready; only when the harness auto-starts it. | `180000` |
742
+ | `deviceIdleTimeoutInMilliseconds` | Max wait after boot for a started emulator to go idle before the session; avoids inflated cold setup. 0 skips. | `60000` |
743
+ | `isAppiumConsoleVisible` | Show the auto-started Appium server console window and live output. Hidden and quiet by default. | `false` |
744
+ | `isEmulatorVisible` | Show the auto-started emulator window. Hidden (`-no-window`, headless) by default so it never steals focus. | `false` |
745
+ | `layoutReadyTimeoutInMilliseconds` | Max wait for `app.workspace.layoutReady` after the vault (re)opens; raise on slow emulators. | `90000` |
746
+ | `sessionConnectionRetryTimeoutInMilliseconds` | Max wait to establish the Appium session (UiAutomator2 install + app launch); the dominant startup cost. | `180000` |
747
+ | `shouldAutoInstallAppiumDependencies` | Auto-install missing Appium + the UiAutomator2 driver before auto-starting the server (global `npm install -g`). | `true` |
748
+ | `shouldAutoStartAppium` | Auto-start the Appium server when it is not already reachable. | `true` |
749
+ | `vaultBasePath` | Base device path where Obsidian stores vaults. | `'/sdcard/Documents/'` |
750
+ | `webviewTimeoutInMilliseconds` | Max wait for the WebView context after the Appium session starts. | `60000` |
750
751
 
751
752
  > [!NOTE]
752
753
  >
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var appium_dependencies_exports = {};
20
+ __export(appium_dependencies_exports, {
21
+ UIAUTOMATOR2_DRIVER_NAME: () => UIAUTOMATOR2_DRIVER_NAME,
22
+ checkIsAppiumDriverInstalled: () => checkIsAppiumDriverInstalled,
23
+ resolveShouldAutoInstallAppiumDependencies: () => resolveShouldAutoInstallAppiumDependencies
24
+ });
25
+ module.exports = __toCommonJS(appium_dependencies_exports);
26
+ const UIAUTOMATOR2_DRIVER_NAME = "uiautomator2";
27
+ function checkIsAppiumDriverInstalled(params) {
28
+ let parsed;
29
+ try {
30
+ parsed = JSON.parse(params.driverListJson);
31
+ } catch {
32
+ return false;
33
+ }
34
+ if (typeof parsed !== "object" || parsed === null) {
35
+ return false;
36
+ }
37
+ return params.driverName in parsed;
38
+ }
39
+ function resolveShouldAutoInstallAppiumDependencies(options) {
40
+ return options.shouldAutoInstallAppiumDependencies ?? true;
41
+ }
42
+ // Annotate the CommonJS export names for ESM import in node:
43
+ 0 && (module.exports = {
44
+ UIAUTOMATOR2_DRIVER_NAME,
45
+ checkIsAppiumDriverInstalled,
46
+ resolveShouldAutoInstallApp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TtBQWdCTyxNQUFNLDJCQUEyQjtBQTZCakMsU0FBUyw2QkFBNkIsUUFBcUQ7QUFDaEcsTUFBSTtBQUNKLE1BQUk7QUFDRixhQUFTLEtBQUssTUFBTSxPQUFPLGNBQWM7QUFBQSxFQUMzQyxRQUFRO0FBQ04sV0FBTztBQUFBLEVBQ1Q7QUFFQSxNQUFJLE9BQU8sV0FBVyxZQUFZLFdBQVcsTUFBTTtBQUNqRCxXQUFPO0FBQUEsRUFDVDtBQUVBLFNBQU8sT0FBTyxjQUFjO0FBQzlCO0FBZU8sU0FBUywyQ0FDZCxTQUNTO0FBQ1QsU0FBTyxRQUFRLHVDQUF1QztBQUN4RDsiLAogICJuYW1lcyI6IFtdCn0K
@@ -0,0 +1,55 @@
1
+ /**
2
+ * @file
3
+ *
4
+ * Pure helpers for deciding whether the harness must auto-install the Appium
5
+ * dependencies (the `uiautomator2` driver) before it auto-starts the Appium
6
+ * server, plus resolving the auto-install opt-out from the transport options.
7
+ * Kept separate from the integration-only `transport-factory` so the parsing and
8
+ * default resolution stay unit-testable (the factory itself shells out to `npm`
9
+ * / `npx` and is excluded from unit tests).
10
+ */
11
+ import type { ObsidianAndroidAppiumTransportOptions } from './transport-options.cjs';
12
+ /**
13
+ * The Appium driver name required to automate Obsidian Mobile on Android.
14
+ */
15
+ export declare const UIAUTOMATOR2_DRIVER_NAME = "uiautomator2";
16
+ /**
17
+ * Parameters for {@link checkIsAppiumDriverInstalled}.
18
+ */
19
+ export interface CheckIsAppiumDriverInstalledParams {
20
+ /**
21
+ * Raw stdout of `appium driver list --installed --json` — a JSON object keyed
22
+ * by installed driver name (`{}` when none are installed).
23
+ */
24
+ readonly driverListJson: string;
25
+ /** The driver name to look for (e.g. {@link UIAUTOMATOR2_DRIVER_NAME}). */
26
+ readonly driverName: string;
27
+ }
28
+ /**
29
+ * Decides whether a given Appium driver is installed, from the raw JSON output
30
+ * of `appium driver list --installed --json`.
31
+ *
32
+ * `--installed` restricts the listing to installed drivers, so a driver is
33
+ * present exactly when its name is a key of the parsed object. Malformed or
34
+ * non-object output (an empty string, a log line that leaked onto stdout, a
35
+ * JSON primitive, `null`) is treated as "not installed" so the caller proceeds
36
+ * to install — the install command is only issued when this returns `false`.
37
+ *
38
+ * @param params - The sampled driver-list output and the driver name to check.
39
+ * @returns `true` when the driver is listed as installed.
40
+ */
41
+ export declare function checkIsAppiumDriverInstalled(params: CheckIsAppiumDriverInstalledParams): boolean;
42
+ /**
43
+ * Resolves whether the harness may auto-install missing Appium dependencies,
44
+ * applying the default when the option is omitted.
45
+ *
46
+ * This only governs the machine-mutating install step (a global `npm install -g
47
+ * appium` and an `appium driver install`); it is a no-op unless the harness is
48
+ * also auto-starting the Appium server ({@link
49
+ * ObsidianAndroidAppiumTransportOptions.shouldAutoStartAppium}). Set it to
50
+ * `false` to manage the Appium toolchain yourself.
51
+ *
52
+ * @param options - The Android Appium transport options.
53
+ * @returns Whether missing Appium dependencies may be auto-installed.
54
+ */
55
+ export declare function resolveShouldAutoInstallAppiumDependencies(options: ObsidianAndroidAppiumTransportOptions): boolean;
@@ -21,7 +21,7 @@ __export(library_exports, {
21
21
  LIBRARY_VERSION: () => LIBRARY_VERSION
22
22
  });
23
23
  module.exports = __toCommonJS(library_exports);
24
- const LIBRARY_VERSION = false ? "dev" : "8.1.1";
24
+ const LIBRARY_VERSION = false ? "dev" : "8.1.2";
25
25
  // Annotate the CommonJS export names for ESM import in node:
26
26
  0 && (module.exports = {
27
27
  LIBRARY_VERSION