jesse-r-s-hines_obsidian-op.../wdio.conf.mts

89 lines
2.7 KiB
TypeScript
Raw Normal View History

2025-02-02 21:32:28 +00:00
import * as path from "path"
2025-08-03 18:21:26 +00:00
import { parseObsidianVersions, obsidianBetaAvailable } from "wdio-obsidian-service";
2026-05-16 16:18:27 +00:00
import { deepmerge } from "deepmerge-ts";
2025-08-03 18:21:26 +00:00
import { env } from "process";
2025-03-15 17:17:36 +00:00
2025-08-03 18:21:26 +00:00
// wdio-obsidian-service will download Obsidian versions into this directory
2025-03-15 17:17:36 +00:00
const cacheDir = path.resolve(".obsidian-cache");
2025-02-02 21:32:28 +00:00
2025-08-03 18:21:26 +00:00
// choose Obsidian versions to test
let defaultVersions = "earliest/earliest latest/latest";
if (await obsidianBetaAvailable({cacheDir})) {
defaultVersions += " latest-beta/latest"
}
const desktopVersions = await parseObsidianVersions(
env.OBSIDIAN_VERSIONS ?? defaultVersions,
{cacheDir},
);
const mobileVersions = await parseObsidianVersions(
env.OBSIDIAN_MOBILE_VERSIONS ?? env.OBSIDIAN_VERSIONS ?? defaultVersions,
{cacheDir},
);
if (env.CI) {
// Print the resolved Obsidian versions to use as the workflow cache key
// (see .github/workflows/test.yaml)
2025-08-03 18:21:26 +00:00
console.log("obsidian-cache-key:", JSON.stringify([desktopVersions, mobileVersions]));
}
const common: WebdriverIO.Capabilities = {
browserName: 'obsidian',
'wdio:obsidianOptions': {
plugins: [
".",
{id: "obsidian-excalidraw-plugin", enabled: false},
{id: "home-tab", enabled: false},
{id: "obsidian-kanban", enabled: false},
],
vault: "./test/vault",
},
2025-03-10 23:58:42 +00:00
}
2025-02-02 21:32:28 +00:00
export const config: WebdriverIO.Config = {
2025-02-13 00:16:05 +00:00
runner: 'local',
2025-07-26 17:18:20 +00:00
framework: 'mocha',
2025-08-03 18:21:26 +00:00
2025-07-26 17:18:20 +00:00
specs: ['./test/specs/**/*.e2e.ts'],
2025-08-03 18:21:26 +00:00
2025-02-13 00:16:05 +00:00
// How many instances of Obsidian should be launched in parallel during testing.
2025-08-03 18:21:26 +00:00
maxInstances: Number(env.WDIO_MAX_INSTANCES || 4),
2025-02-02 21:32:28 +00:00
2025-08-03 18:21:26 +00:00
// "matrix" to test your plugin on multiple Obsidian versions and with emulateMobile
capabilities: [
2026-05-16 16:18:27 +00:00
...desktopVersions.map(([appVersion, installerVersion]) => deepmerge(common, {
2025-07-20 15:36:01 +00:00
'wdio:obsidianOptions': {
2025-08-03 18:21:26 +00:00
appVersion, installerVersion,
2025-07-20 15:36:01 +00:00
},
2025-08-03 18:21:26 +00:00
})),
// Test the plugin on the emulated mobile UI.
2026-05-16 16:18:27 +00:00
...mobileVersions.map(([appVersion, installerVersion]) => deepmerge(common, {
2025-08-03 18:21:26 +00:00
'wdio:obsidianOptions': {
appVersion, installerVersion,
emulateMobile: true,
},
'goog:chromeOptions': {
mobileEmulation: {
deviceMetrics: {width: 390, height: 844, touch: false},
2025-07-20 15:36:01 +00:00
},
},
2025-08-03 18:21:26 +00:00
})),
],
2025-02-02 21:32:28 +00:00
2025-03-22 19:27:08 +00:00
services: ["obsidian"],
2025-03-15 17:17:18 +00:00
reporters: ['obsidian'],
2025-02-02 21:32:28 +00:00
2025-07-26 17:18:20 +00:00
bail: 2,
2025-02-13 00:16:05 +00:00
mochaOpts: {
ui: 'bdd',
2025-08-03 18:21:26 +00:00
timeout: 60 * 1000,
retries: 2,
2025-03-22 14:53:59 +00:00
bail: true,
2025-02-13 00:16:05 +00:00
},
specFileRetries: 2,
waitforInterval: 250,
waitforTimeout: 5 * 1000,
2025-02-16 21:40:49 +00:00
logLevel: "warn",
2025-08-03 18:21:26 +00:00
cacheDir: cacheDir,
2025-02-02 21:32:28 +00:00
}