obsidian-testing-framework 0.3.3 → 0.3.4
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/lib/fixtures.d.ts +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +16 -7
- package/package.json +1 -1
package/lib/fixtures.d.ts
CHANGED
package/lib/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare const test: import("vitest").TestAPI<{
|
|
|
7
7
|
page: import("playwright-core").Page;
|
|
8
8
|
obsidian: ObsidianTestingConfig;
|
|
9
9
|
electronApp: import("playwright-core").ElectronApplication;
|
|
10
|
+
___vaultId: string;
|
|
10
11
|
appHandle: import("playwright-core").JSHandle<import("obsidian").App>;
|
|
11
12
|
vaultPoolDir: string;
|
|
12
13
|
}>;
|
package/lib/index.js
CHANGED
|
@@ -69,18 +69,24 @@ export const test = base.extend({
|
|
|
69
69
|
},
|
|
70
70
|
{ scope: "worker", auto: true },
|
|
71
71
|
],
|
|
72
|
-
|
|
72
|
+
___vaultId: [
|
|
73
73
|
async ({ vaultPoolDir }, run) => {
|
|
74
|
-
const obsidianPath = inject("obsidianPath") ?? undefined;
|
|
75
74
|
const vault = inject("vault");
|
|
76
75
|
const concurrent = inject("concurrent") ?? "copy";
|
|
77
76
|
process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = "true";
|
|
77
|
+
const vaultId = generateVaultConfig(vault, concurrent, vaultPoolDir);
|
|
78
|
+
await run(vaultId);
|
|
79
|
+
},
|
|
80
|
+
{ auto: true },
|
|
81
|
+
],
|
|
82
|
+
electronApp: [
|
|
83
|
+
async ({ ___vaultId: vaultId }, run) => {
|
|
84
|
+
const obsidianPath = inject("obsidianPath") ?? undefined;
|
|
78
85
|
console.log("asar located at:", getExe(obsidianPath));
|
|
79
86
|
let uriArg = "";
|
|
80
|
-
if (
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
uriArg = `obsidian://open?vault=${encodeURIComponent(id)}`;
|
|
87
|
+
if (vaultId) {
|
|
88
|
+
if (!!vaultId) {
|
|
89
|
+
uriArg = `obsidian://open?vault=${encodeURIComponent(vaultId)}`;
|
|
84
90
|
}
|
|
85
91
|
}
|
|
86
92
|
const electronApp = await electron.launch({
|
|
@@ -95,10 +101,13 @@ export const test = base.extend({
|
|
|
95
101
|
{ auto: true },
|
|
96
102
|
],
|
|
97
103
|
page: [
|
|
98
|
-
async ({ electronApp }, run) => {
|
|
104
|
+
async ({ electronApp, ___vaultId: vaultId }, run) => {
|
|
99
105
|
const windows = electronApp.windows();
|
|
100
106
|
// console.log("windows", windows);
|
|
101
107
|
let page = windows[windows.length - 1];
|
|
108
|
+
await page.evaluate(() => {
|
|
109
|
+
window.localStorage.setItem(`enable-plugin-${vaultId}`, "true");
|
|
110
|
+
});
|
|
102
111
|
await page.waitForLoadState("domcontentloaded");
|
|
103
112
|
try {
|
|
104
113
|
await waitForIndexingComplete(page);
|