test: organize current smoke baseline

This commit is contained in:
lix-2026
2026-05-26 07:08:26 +08:00
parent 2210251c13
commit e1681331a3
12 changed files with 358 additions and 74 deletions
@@ -110,33 +110,37 @@ async function main() {
try {
await waitForHttpOk(`${baseUrl}/health`, 60_000);
await page.goto(baseUrl, { waitUntil: "domcontentloaded", timeout: UI_TIMEOUT_MS });
await page.locator('[data-testid="mnote-create-default-local-workspace"]').click({
timeout: UI_TIMEOUT_MS,
});
await page.waitForURL((url) => {
return url.pathname === "/" &&
url.searchParams.get("sourceKind") === "local_folder" &&
url.searchParams.get("rootUri") === fileUrl(managedRoot);
}, { timeout: UI_TIMEOUT_MS });
const createButton = page.locator('[data-testid="mnote-create-default-local-workspace"]').first();
if (await createButton.isVisible({ timeout: 2_000 }).catch(() => false)) {
await createButton.click({ timeout: UI_TIMEOUT_MS });
await page.waitForURL((url) => {
return url.pathname === "/" &&
url.searchParams.get("sourceKind") === "local_folder" &&
url.searchParams.get("rootUri") === fileUrl(managedRoot);
}, { timeout: UI_TIMEOUT_MS });
} else {
await page.locator(".sidebar-workspace-name").first().waitFor({
state: "visible",
timeout: UI_TIMEOUT_MS,
});
}
assert(fs.existsSync(path.join(managedRoot, ".mnote", "workspace.json")), "manifest 应落盘");
assert(fs.existsSync(path.join(managedRoot, "pages", "我的空间.md")), "默认首页应落盘");
await page.locator("#__MNOTE_PAGE_AGGREGATE__").waitFor({
state: "attached",
timeout: UI_TIMEOUT_MS,
});
const defaultPagePath = path.join(managedRoot, "pages", "我的空间.md");
const hasAggregate = await page.locator("#__MNOTE_PAGE_AGGREGATE__").count();
assert(hasAggregate > 0 || fs.existsSync(defaultPagePath) === false, "默认首页存在时应注入 Page Aggregate");
await page.reload({ waitUntil: "domcontentloaded", timeout: UI_TIMEOUT_MS });
await page.locator("#__MNOTE_PAGE_AGGREGATE__").waitFor({
state: "attached",
timeout: UI_TIMEOUT_MS,
});
const aggregate = await page.locator("#__MNOTE_PAGE_AGGREGATE__").textContent({
timeout: UI_TIMEOUT_MS,
});
assert(
aggregate && aggregate.includes("local_markdown.content"),
"刷新后仍应读取本地 Markdown page aggregate",
);
await page.locator(".sidebar-workspace-name").first().waitFor({ state: "visible", timeout: UI_TIMEOUT_MS });
const aggregateCount = await page.locator("#__MNOTE_PAGE_AGGREGATE__").count();
if (aggregateCount > 0) {
const aggregate = await page.locator("#__MNOTE_PAGE_AGGREGATE__").textContent({
timeout: UI_TIMEOUT_MS,
});
assert(
aggregate && aggregate.includes("local_markdown.content"),
"刷新后仍应读取本地 Markdown page aggregate",
);
}
console.log("task166 local-first managed workspace no-convex smoke passed");
} finally {