(page: Page, relativePath: string)
| 116 | } |
| 117 | |
| 118 | async 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 | |
| 139 | async function readTaskDates(page: Page): Promise<TaskDates> { |
| 140 | return page.evaluate(async (targetPath) => { |
no test coverage detected