fix: 外部导入笔记后自动刷新侧栏

Co-Authored-By: Codex <noreply@anthropic.com>
This commit is contained in:
2026-08-13 07:52:50 +08:00
co-authored by Codex
parent 645c04ed01
commit 1838435984
2 changed files with 83 additions and 5 deletions
+25
View File
@@ -394,6 +394,31 @@ test("polling still delivers external edits when /.events is unavailable", async
expect(eventsRequestCount).toBe(1);
});
test("external Markdown folders appear in the open sidebar after indexing", async ({
sbPage,
sbServer,
}) => {
const importedFolder = "极空间记事本";
const sidebar = sbPage.getByRole("complementary", {
name: "Plainleaf 导航",
});
await expect(sidebar.getByText(importedFolder, { exact: true })).toHaveCount(
0,
);
await mkdir(join(sbServer.spaceDir, importedFolder), { recursive: true });
await writeFile(
join(sbServer.spaceDir, importedFolder, "导入示例.md"),
"# 导入示例\n",
);
// The regular file-list scan detects and indexes the new file. Once that
// batch drains, the page-list cache must refresh without a browser reload.
await expect(
sidebar.getByText(importedFolder, { exact: true }),
).toBeVisible({ timeout: 15_000 });
});
test("reconnects with backoff after a transient connection failure", async ({
page,
sbServer,