MCPcopy
hub / github.com/callumalpass/tasknotes / openBaseFile

Function openBaseFile

e2e/issues/issue-1441-span-task-drag-broken.spec.ts:118–137  ·  view source on GitHub ↗
(page: Page, relativePath: string)

Source from the content-addressed store, hash-verified

116}
117
118async function openBaseFile(page: Page, relativePath: string): Promise<void> {
119 const opened = await page.evaluate(async (targetPath) => {
120 const obsidianApp = (window as any).app;
121 const file = obsidianApp?.vault?.getAbstractFileByPath?.(targetPath);
122 if (!file) return false;
123 await obsidianApp.workspace.getLeaf(false).openFile(file);
124 return true;
125 }, relativePath);
126
127 if (!opened) {
128 throw new Error(`Could not open ${relativePath}`);
129 }
130
131 await expect(page.locator(`${ACTIVE_LEAF_SELECTOR} .fc`).first()).toBeVisible({ timeout: 10000 });
132 const monthButton = page.locator(`${ACTIVE_LEAF_SELECTOR} .fc-dayGridMonth-button`).first();
133 if (await monthButton.isVisible({ timeout: 2000 }).catch(() => false)) {
134 await monthButton.click();
135 }
136 await page.waitForTimeout(500);
137}
138
139async function readTaskDates(page: Page): Promise<TaskDates> {
140 return page.evaluate(async (targetPath) => {

Calls 2

getAbstractFileByPathMethod · 0.80
getLeafMethod · 0.80

Tested by

no test coverage detected