WDIO Obsidian Service

    The ObsidianLauncher class.

    Helper class that handles downloading and installing Obsidian versions, plugins, and themes and launching Obsidian with sandboxed configuration directories.

    Index

    Constructors

    • Construct an ObsidianLauncher.

      Parameters

      • options: {
            cacheDir?: string;
            versionsUrl?: string;
            communityPluginsUrl?: string;
            communityThemesUrl?: string;
            cacheDuration?: number;
        } = {}
        • OptionalcacheDir?: string

          Path to the cache directory. Defaults to "OBSIDIAN_CACHE" env var or ".obsidian-cache".

        • OptionalversionsUrl?: string

          Custom obsidian-versions.json url. Can be a file URL.

        • OptionalcommunityPluginsUrl?: string

          Custom community-plugins.json url. Can be a file URL.

        • OptionalcommunityThemesUrl?: string

          Custom community-css-themes.json url. Can be a file URL.

        • OptionalcacheDuration?: number

          If the cached version list is older than this (in ms), refetch it. Defaults to 30 minutes.

      Returns default

    Properties

    cacheDir: string
    versionsUrl: string
    communityPluginsUrl: string
    communityThemesUrl: string
    cacheDuration: number

    Methods

    • Resolves Obsidian app and installer version strings to absolute versions.

      Parameters

      • appVersion: string

        Obsidian version string or one of

        • "latest": Get the current latest non-beta Obsidian version
        • "latest-beta": Get the current latest beta Obsidian version (or latest is there is no current beta)
        • "earliest": Get the minAppVersion set in your manifest.json
      • installerVersion: string = "latest"

        Obsidian version string or one of

        • "latest": Get the latest Obsidian installer compatible with appVersion
        • "earliest": Get the oldest Obsidian installer compatible with appVersion

        See also: Obsidian App vs Installer Versions

      Returns Promise<[string, string]>

      [appVersion, installerVersion] with any "latest" etc. resolved to specific versions.

    • Downloads the Obsidian installer for the given version and current platform. Returns the file path.

      Parameters

      • installerVersion: string

        Obsidian installer version to download

      Returns Promise<string>

    • Downloads the Obsidian asar for the given version. Returns the file path.

      To download beta versions you'll need to have an Obsidian account with Catalyst and set the OBSIDIAN_USERNAME and OBSIDIAN_PASSWORD environment variables. 2FA needs to be disabled.

      Parameters

      • appVersion: string

        Obsidian version to download

      Returns Promise<string>

    • Downloads chromedriver for the given Obsidian version.

      wdio will download chromedriver from the Chrome for Testing API automatically (see https://github.com/GoogleChromeLabs/chrome-for-testing#json-api-endpoints). However, Google has only put chromedriver since v115.0.5763.0 in that API, so wdio can't automatically download older versions of chromedriver for old Electron versions. Here we download chromedriver for older versions ourselves using the @electron/get package which fetches chromedriver from https://github.com/electron/electron/releases.

      Parameters

      • installerVersion: string

        Obsidian installer version

      Returns Promise<string>

    • Downloads a list of plugins to the cache and returns a list of DownloadedPluginEntry with the downloaded paths. Also adds the id property to the plugins based on the manifest.

      You can download plugins from GitHub using {repo: "org/repo"} and community plugins using {id: 'plugin-id'}. Local plugins will just be passed through.

      Parameters

      Returns Promise<DownloadedPluginEntry[]>

    • Downloads a list of themes to the cache and returns a list of DownloadedThemeEntry with the downloaded paths. Also adds the name property to the plugins based on the manifest.

      You can download themes from GitHub using {repo: "org/repo"} and community themes using {name: 'theme-name'}. Local themes will just be passed through.

      Parameters

      Returns Promise<DownloadedThemeEntry[]>

    • Installs plugins into an Obsidian vault

      Parameters

      • vault: string

        Path to the vault to install the plugins in

      • plugins: PluginEntry[]

        List plugins to install

      Returns Promise<void>

    • Installs themes into an Obsidian vault

      Parameters

      • vault: string

        Path to the theme to install the themes in

      • themes: ThemeEntry[]

        List of themes to install

      Returns Promise<void>

    • Sets up the config dir to use for the --user-data-dir in obsidian. Returns the path to the created config dir.

      Parameters

      • params: {
            appVersion: string;
            installerVersion: string;
            appPath?: string;
            vault?: string;
            dest?: string;
        }
        • appVersion: string

          Obsidian app version

        • installerVersion: string

          Obsidian version string.

        • OptionalappPath?: string

          Path to the asar file to install. Will download if omitted.

        • Optionalvault?: string

          Path to the vault to open in Obsidian.

        • Optionaldest?: string

          Destination path for the config dir. If omitted it will create a temporary directory.

      Returns Promise<string>

    • Sets up a vault for Obsidian, installing plugins and themes and optionally copying the vault to a temporary directory first.

      Parameters

      • params: {
            vault: string;
            copy?: boolean;
            plugins?: PluginEntry[];
            themes?: ThemeEntry[];
        }
        • vault: string

          Path to the vault to open in Obsidian

        • Optionalcopy?: boolean

          Whether to copy the vault to a tmpdir first. Default false

        • Optionalplugins?: PluginEntry[]

          List of plugins to install in the vault

        • Optionalthemes?: ThemeEntry[]

          List of themes to install in the vault

      Returns Promise<string>

      Path to the copied vault (or just the path to the vault if copy is false)

    • Downloads and launches Obsidian with a sandboxed config dir and a specifc vault open. Optionally install plugins and themes first.

      This is just a shortcut for calling downloadApp, downloadInstaller, setupVault and setupConfDir.

      Parameters

      • params: {
            appVersion?: string;
            installerVersion?: string;
            copy?: boolean;
            vault?: string;
            plugins?: PluginEntry[];
            themes?: ThemeEntry[];
            args?: string[];
            spawnOptions?: SpawnOptions;
        }
        • OptionalappVersion?: string

          Obsidian app version. Default "latest"

        • OptionalinstallerVersion?: string

          Obsidian installer version. Default "latest"

        • Optionalcopy?: boolean

          Whether to copy the vault to a tmpdir first. Default false

        • Optionalvault?: string

          Path to the vault to open in Obsidian

        • Optionalplugins?: PluginEntry[]

          List of plugins to install in the vault

        • Optionalthemes?: ThemeEntry[]

          List of themes to install in the vault

        • Optionalargs?: string[]

          CLI args to pass to Obsidian

        • OptionalspawnOptions?: SpawnOptions

          Options to pass to spawn

      Returns Promise<{ proc: ChildProcess; configDir: string; vault?: string }>

      The launched child process and the created tmpdirs

    • Updates the info obsidian-versions.json. The obsidian-versions.json file is used in other launcher commands and in wdio-obsidian-service to get metadata about Obsidian versions in one place such as minInstallerVersion and the internal electron version.

      Parameters

      Returns Promise<ObsidianVersionInfos>

    • Returns true if the Obsidian version is already in the cache.

      Parameters

      • type: "installer" | "app"

        on of "app" or "installer"

      • version: string

        Obsidian app/installer version

      Returns Promise<boolean>

    • Returns true if we either have the credentials to download the version or it's already in cache. This is only relevant for Obsidian beta versions, as they require Obsidian insider credentials to download.

      Parameters

      • appVersion: string

        Obsidian app version

      Returns Promise<boolean>

    MMNEPVFCICPMFPCPTTAAATR