Skip to content

test-runners/wdio-obsidian

End-to-end tests with wdio-obsidian-service: WebdriverIO drives a sandboxed copy of Obsidian, downloaded per version into a cache, with the plugin installed into a copy of the test vault.

defineWdioObsidianConfig derives the wdio.conf.mts from the project’s layout, and testEndToEndWithWdioObsidian is the test:e2e script: a production build, then wdio run.

The config is typed structurally rather than through @wdio/types, so this module costs a project that does not use WebdriverIO nothing, and the returned object is assignable to WebdriverIO.Config in one that does.

Interface Description
DefineWdioObsidianConfigOptions Options for defineWdioObsidianConfig.
TestEndToEndWithWdioObsidianOptions Options for testEndToEndWithWdioObsidian.
WdioObsidianCapability A wdio-obsidian-service capability: one Obsidian version to run the specs against.
WdioObsidianCapabilityOptions The wdio:obsidianOptions of a WdioObsidianCapability.
WdioObsidianConfig The WebdriverIO configuration defineWdioObsidianConfig returns. Every field is plain data, so a project changes any of them by spreading the result: \{ ...defineWdioObsidianConfig(), logLevel: 'info' \}.
WdioObsidianMochaOptions The mochaOpts of a WdioObsidianConfig.
Function Description
defineWdioObsidianConfig Builds the WebdriverIO configuration for end-to-end tests with wdio-obsidian-service, derived from the plugin’s layout: the production build in dist/build is the plugin under test, the demo vault (when there is one) is the vault, and the specs live in e2e/. wdio.conf.mts: ts import \{ defineWdioObsidianConfig \} from '@mnaoumov/obsidian-dev-toolkit/test-runners/wdio-obsidian'; export const config: WebdriverIO.Config = defineWdioObsidianConfig(\{ appVersions: ['earliest', 'latest'] \});
testEndToEndWithWdioObsidian Runs the end-to-end tests with wdio-obsidian-service: the production build, then wdio run <config>. It is the body of a plugin’s test:e2e script.
Variable Description
DEFAULT_WDIO_OBSIDIAN_TEST_TIMEOUT_IN_MILLISECONDS The per-test timeout defineWdioObsidianConfig gives mocha by default, in milliseconds. Obsidian is started once per spec file, which a single test’s budget has to absorb.
WDIO_CONFIG_FILE_NAMES The config files testEndToEndWithWdioObsidian looks for, in order.