推进 OCR UI 与 provider 删除验收
This commit is contained in:
@@ -36,7 +36,7 @@ node scripts/task490-runtime-surfaces-smoke.js
|
||||
- Rust SSR 文档页 / Page Aggregate:local-first 默认优先 `task167-local-markdown-title-body-options-no-convex-smoke.js`;Page Aggregate browser conversion / compat fallback 改动补跑 `task522-page-aggregate-compat-fallback-contract.js`;cloud/control-plane 文档可补跑 `task110-page-title-single-truth-smoke.js`、`task-page-aggregate-body-sync-smoke.js`、`task-page-aggregate-options-sync-smoke.js`、`task-page-aggregate-refresh-persistence-smoke.js`
|
||||
- leptos-tiptap runtime surface:`task490-runtime-surfaces-smoke.js`;需要验证保存回读可补跑 `task121-rust-web-editor-island-hydration-smoke.js`,但它仍使用 `/api/tree/commands create` 准备文档,不作为无 Convex 默认基线;需要验证浮层互斥和更多菜单状态时再跑 `task158-e30-menu-state-smoke.js`
|
||||
- local-first 本地工作区:`task164-desktop-hot-local-folder-main-entry-smoke.js`、`task166-local-first-managed-workspace-no-convex-smoke.js`、`task167-local-markdown-title-body-options-no-convex-smoke.js`、`task436-local-markdown-open-document-external-change-smoke.js`、`task443-local-markdown-asset-upload-smoke.js`、`task451-local-markdown-conflict-resolution-ui-smoke.js`、`task452-local-search-index-browser-smoke.js`、`task453-local-folder-page-ai-changed-files-smoke.js`;WorkspacePath / ObjectIdentity runtime 消费统一改动补跑 `task524-workspace-object-identity-matrix-smoke.js`
|
||||
- local-folder OCR:`task526-local-folder-ocr-api-smoke.js` 覆盖 mock OCR API、sidecar 落盘、jobs/status/read、`includeOcr=true` 搜索 owner page、显式插入 OCR 链接和 OCR sidecar Markdown resource tab 打开;它不代表真实 MinerU token/upload/zip runtime、前端 OCR 入口或全局 OCR 任务栏已完成。
|
||||
- local-folder OCR:`task526-local-folder-ocr-api-smoke.js` 覆盖图片 resource tab 手动 OCR、工具条状态、mock OCR API、sidecar 落盘、jobs/status/read、`includeOcr=true` 搜索 owner page、显式插入 OCR 链接和 OCR sidecar Markdown resource tab 打开;它不代表全局 OCR 任务栏 / 任务抽屉、active job store 或 `local_ocr.job.updated` 已完成。
|
||||
- local Markdown conflict regression:`task510-local-markdown-conflict-regression-group.js` 串联真实冲突、连续上传、新建页面、外部恢复、多 tab CAS 与上传 409 孤儿策略;可用 `MNOTE_CONFLICT_REGRESSION_TASKS=a.js,b.js` 做定点子集。
|
||||
- tree realtime / live cache:`task446-tree-rename-dual-browser-live-smoke.js`、`task447-tree-move-order-dual-browser-live-smoke.js`、`task448-tree-resync-recovery-dual-browser-smoke.js`、`task449-tree-sse-reconnect-snapshot-recovery-smoke.js`
|
||||
- 资源对象与 mindmap:`task455-local-folder-mindmap-clean-smoke.js`、`task456-resource-object-shell-sync-smoke.js`、`task166-mindmap-phase6-block-smoke.js`、`task167-mindmap-kmind-parity-smoke.js`、`task168-mindmap-put-validator-smoke.js`;Page AI mindmap skill / 资源生成改动补跑 `task503-mindmap-skill-capability-smoke.js`,真实 mindmap resource tab / Page AI target 改动补跑 `task525-page-ai-mindmap-resource-target-smoke.js`
|
||||
|
||||
@@ -96,6 +96,59 @@ async function main() {
|
||||
screenshots.page = path.join(OUTPUT_DIR, "01-page.png");
|
||||
await page.screenshot({ path: screenshots.page, fullPage: true });
|
||||
|
||||
await page.waitForFunction(() => Boolean(window.__mnoteDocumentPaneRuntime?.openResourceInActiveTab), null, {
|
||||
timeout: UI_TIMEOUT_MS,
|
||||
});
|
||||
await page.evaluate(async ({ rootUri, documentId, sourceRootRelativePath, workspaceId }) => {
|
||||
window.__MNOTE_LOCAL_OCR_PROVIDER = "mock";
|
||||
const title = sourceRootRelativePath.split("/").filter(Boolean).pop() || "photo.png";
|
||||
const fileUrl = new URL("/api/local-folder/files/open", window.location.origin);
|
||||
fileUrl.searchParams.set("rootUri", rootUri);
|
||||
fileUrl.searchParams.set("path", sourceRootRelativePath);
|
||||
const opened = await window.__mnoteDocumentPaneRuntime.openResourceInActiveTab({
|
||||
objectIdentity: `local-file:${sourceRootRelativePath}`,
|
||||
assetId: `local-file:${sourceRootRelativePath}`,
|
||||
title,
|
||||
fileName: title,
|
||||
kind: "image",
|
||||
rootUri,
|
||||
path: sourceRootRelativePath,
|
||||
href: fileUrl.toString(),
|
||||
documentId,
|
||||
ownerDocumentId: documentId,
|
||||
workspaceId,
|
||||
sourceKind: "local_folder",
|
||||
});
|
||||
if (!opened) throw new Error("OCR source image resource tab did not open");
|
||||
}, {
|
||||
rootUri: fileUrl(root),
|
||||
documentId,
|
||||
sourceRootRelativePath,
|
||||
workspaceId,
|
||||
});
|
||||
await page.locator('[data-testid="mnote-local-ocr-toolbar"]').first().waitFor({
|
||||
state: "visible",
|
||||
timeout: UI_TIMEOUT_MS,
|
||||
});
|
||||
await page.getByTestId("mnote-local-ocr-run").click({ timeout: UI_TIMEOUT_MS });
|
||||
await page.waitForFunction(() => document.querySelector('[data-mnote-local-ocr-status="done"]'), null, {
|
||||
timeout: UI_TIMEOUT_MS,
|
||||
});
|
||||
const uiOcrPath = await page.locator('[data-mnote-local-ocr-path]').first().getAttribute("data-mnote-local-ocr-path");
|
||||
assert(uiOcrPath && uiOcrPath.endsWith(".ocr.md"), `UI OCR path invalid: ${uiOcrPath}`);
|
||||
screenshots.ocrToolbar = path.join(OUTPUT_DIR, "02-ocr-toolbar.png");
|
||||
await page.screenshot({ path: screenshots.ocrToolbar, fullPage: true });
|
||||
await page.getByTestId("mnote-local-ocr-insert").click({ timeout: UI_TIMEOUT_MS });
|
||||
await page.getByTestId("mnote-local-ocr-status").filter({ hasText: "OCR 链接已插入正文" }).waitFor({
|
||||
state: "visible",
|
||||
timeout: UI_TIMEOUT_MS,
|
||||
});
|
||||
await page.getByTestId("mnote-local-ocr-open").click({ timeout: UI_TIMEOUT_MS });
|
||||
await page.locator('[data-mnote-resource-tab-panel][data-resource-kind="markdown"]:not([hidden]) [data-testid="mnote-leptos-tiptap-island-editor-root"]').first().waitFor({
|
||||
state: "visible",
|
||||
timeout: UI_TIMEOUT_MS,
|
||||
});
|
||||
|
||||
const result = await page.evaluate(async ({ rootUri, documentId, sourceRootRelativePath, workspaceId, ocrToken }) => {
|
||||
async function jsonFetch(pathname, init = {}) {
|
||||
const response = await fetch(pathname, {
|
||||
@@ -187,9 +240,6 @@ async function main() {
|
||||
const ownerMarkdown = fs.readFileSync(path.join(root, relativePath), "utf8");
|
||||
assert(ownerMarkdown.includes(`[OCR:photo.png](`), `owner markdown should include explicit OCR link:\n${ownerMarkdown}`);
|
||||
|
||||
await page.waitForFunction(() => Boolean(window.__mnoteDocumentPaneRuntime?.openResourceInActiveTab), null, {
|
||||
timeout: UI_TIMEOUT_MS,
|
||||
});
|
||||
const openResourceResult = await page.evaluate(async ({ rootUri, documentId, ocrRootRelativePath, workspaceId }) => {
|
||||
const runtime = window.__mnoteDocumentPaneRuntime;
|
||||
if (!runtime || typeof runtime.openResourceInActiveTab !== "function") {
|
||||
@@ -216,11 +266,11 @@ async function main() {
|
||||
workspaceId,
|
||||
});
|
||||
assert.equal(openResourceResult, true, "OCR sidecar resource tab should open");
|
||||
await page.locator('[data-mnote-resource-tab-panel][data-resource-kind="markdown"] [data-testid="mnote-leptos-tiptap-island-editor-root"]').first().waitFor({
|
||||
await page.locator('[data-mnote-resource-tab-panel][data-resource-kind="markdown"]:not([hidden]) [data-testid="mnote-leptos-tiptap-island-editor-root"]').first().waitFor({
|
||||
state: "visible",
|
||||
timeout: UI_TIMEOUT_MS,
|
||||
});
|
||||
screenshots.ocrResource = path.join(OUTPUT_DIR, "02-ocr-resource-tab.png");
|
||||
screenshots.ocrResource = path.join(OUTPUT_DIR, "03-ocr-resource-tab.png");
|
||||
await page.screenshot({ path: screenshots.ocrResource, fullPage: true });
|
||||
|
||||
await writeResult({
|
||||
|
||||
Reference in New Issue
Block a user