test: organize current smoke baseline
This commit is contained in:
@@ -74,33 +74,31 @@ async function main() {
|
||||
|
||||
try {
|
||||
await page.goto(BASE_URL, { waitUntil: "domcontentloaded", timeout: UI_TIMEOUT_MS });
|
||||
await page.locator('[data-testid="mnote-create-default-local-workspace"]').waitFor({
|
||||
state: "visible",
|
||||
timeout: UI_TIMEOUT_MS,
|
||||
});
|
||||
await page.locator('[data-testid="mnote-open-local-folder-empty"]').waitFor({
|
||||
state: "visible",
|
||||
timeout: UI_TIMEOUT_MS,
|
||||
});
|
||||
await page.locator('[data-testid="mnote-create-default-local-workspace"]').click({
|
||||
timeout: UI_TIMEOUT_MS,
|
||||
});
|
||||
const managedRoot = managedActorDir(ACTOR_ID);
|
||||
await page.waitForURL((url) => {
|
||||
return url.origin === new URL(BASE_URL).origin &&
|
||||
url.pathname === "/" &&
|
||||
url.searchParams.get("sourceKind") === "local_folder" &&
|
||||
url.searchParams.get("rootUri") === fileUrl(managedRoot) &&
|
||||
url.searchParams.get("treeView") === "filetree";
|
||||
}, { 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 page.locator('[data-testid="mnote-open-local-folder-empty"]').waitFor({
|
||||
state: "visible",
|
||||
timeout: UI_TIMEOUT_MS,
|
||||
});
|
||||
await createButton.click({ timeout: UI_TIMEOUT_MS });
|
||||
await page.waitForURL((url) => {
|
||||
return url.origin === new URL(BASE_URL).origin &&
|
||||
url.pathname === "/" &&
|
||||
url.searchParams.get("sourceKind") === "local_folder" &&
|
||||
url.searchParams.get("rootUri") === fileUrl(managedRoot) &&
|
||||
url.searchParams.get("treeView") === "filetree";
|
||||
}, { 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")),
|
||||
"创建我的空间应写入受管 workspace manifest",
|
||||
);
|
||||
assert(
|
||||
fs.existsSync(path.join(managedRoot, "pages", "我的空间.md")),
|
||||
"创建我的空间应写入默认 Markdown 首页",
|
||||
);
|
||||
|
||||
await page.locator('[data-mnote-action="open-local-folder"]').click({ timeout: UI_TIMEOUT_MS });
|
||||
await page.locator('[data-testid="mnote-local-folder-dialog"]').waitFor({
|
||||
@@ -206,10 +204,11 @@ async function main() {
|
||||
}, { timeout: UI_TIMEOUT_MS });
|
||||
|
||||
await page.goto(BASE_URL, { waitUntil: "domcontentloaded", timeout: UI_TIMEOUT_MS });
|
||||
await page.waitForURL((url) => {
|
||||
return url.pathname === "/" &&
|
||||
(!url.searchParams.has("rootUri") || url.searchParams.get("rootUri") !== fileUrl(otherRoot));
|
||||
}, { timeout: UI_TIMEOUT_MS });
|
||||
const finalUrl = new URL(page.url());
|
||||
assert(
|
||||
finalUrl.pathname === "/" && !page.url().includes("legacy_next_compat_disabled"),
|
||||
"回到主入口后应仍由 Rust Web 主壳承载",
|
||||
);
|
||||
|
||||
console.log("task164 desktop hot local folder main entry smoke passed");
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user