feat(desktop): open project documents by type

This commit is contained in:
2026-07-26 00:09:33 +08:00
parent f67660f3e5
commit 139e0d59ed
5 changed files with 47 additions and 13 deletions

View File

@@ -32,6 +32,7 @@ await page.route('http://localhost:9150/api/v1/**', async (route) => {
if (path === '/api/v1/auth/me') return route.fulfill({ json: user })
if (path === '/api/v1/projects') return route.fulfill({ json: [workspace.project] })
if (path === `/api/v1/projects/${projectId}/workspace`) return route.fulfill({ json: workspace })
if (path === `/api/v1/projects/${projectId}/documents/doc-1`) return route.fulfill({ json: { ...workspace.documents[0], revision: 1, markdown: '# 版本规划\n\n记录交付安排。', hasBlob: false, size: 32, createdAt: '2026-07-22T10:00:00Z' } })
if (path === '/api/v1/ai-experts') return route.fulfill({ json: [expert] })
if (path === '/api/v1/dataset-sources') return route.fulfill({ json: [datasetSource] })
if (path === '/api/v1/dataset-items') return route.fulfill({ json: { items: [datasetItem], total: 1, limit: 50, offset: 0 } })
@@ -65,6 +66,10 @@ await page.getByRole('option', { name: '森林项目' }).click()
await page.waitForSelector('.channel-rail')
await page.locator('.channel-rail button[title="资料"]').click()
const documents = await page.locator('.detail-row').count()
await page.locator('.document-row').first().click()
await page.waitForSelector('.markdown-editor-page')
const markdownEditing = await page.locator('.markdown-editor-page').count()
await page.locator('.markdown-editor-page .content-heading .arco-btn').click()
const documentActions = await page.locator('.document-actions .arco-btn').count()
await page.locator('.document-actions .arco-btn').nth(1).click()
await page.waitForSelector('.markdown-editor-page')
@@ -99,9 +104,9 @@ if (home.pending !== 1 || home.completed !== 0) failures.push(`all-project task
if (taskModal !== 1) failures.push('task editor did not open')
if (exploreSources !== 2 || exploreDetail !== 1) failures.push(`explore reader did not render: ${JSON.stringify({ exploreSources, exploreDetail })}`)
if (documents !== 1) failures.push(`expected one document, got ${documents}`)
if (documentActions !== 2 || markdownEditor !== 1) failures.push(`document actions did not render: ${JSON.stringify({ documentActions, markdownEditor })}`)
if (documentActions !== 2 || markdownEditor !== 1 || markdownEditing !== 1) failures.push(`document actions did not render: ${JSON.stringify({ documentActions, markdownEditor, markdownEditing })}`)
if (experts !== 1 || aiSwitches !== 2 || aiHistory !== 1) failures.push(`AI session pages did not render: ${JSON.stringify({ experts, aiSwitches, aiHistory })}`)
if (profileMenu !== 1) failures.push('profile menu did not open')
if (errors.length) failures.push(`console errors: ${errors.join('; ')}`)
console.log(JSON.stringify({ home, documents, documentActions, markdownEditor, markdownLayout, experts, aiSwitches, aiHistory, taskModal, exploreSources, exploreDetail, profileMenu, errors }, null, 2))
console.log(JSON.stringify({ home, documents, documentActions, markdownEditor, markdownEditing, markdownLayout, experts, aiSwitches, aiHistory, taskModal, exploreSources, exploreDetail, profileMenu, errors }, null, 2))
if (failures.length) throw new Error(failures.join('\n'))