feat(desktop): add document upload and markdown editor

This commit is contained in:
2026-07-25 23:46:24 +08:00
parent dbf5c33c99
commit 562c6b1bdb
4 changed files with 57 additions and 12 deletions

View File

@@ -65,6 +65,16 @@ 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()
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')
await page.screenshot({ path: 'test-results/app-markdown-new.png', fullPage: true })
const markdownEditor = await page.locator('.markdown-editor-page').count()
const markdownLayout = await page.evaluate(() => {
const rect = (selector) => { const node = document.querySelector(selector); const value = node?.getBoundingClientRect(); return value ? { left: value.left, width: value.width } : null }
return { scrollX: window.scrollX, scrollWidth: document.documentElement.scrollWidth, clientWidth: document.documentElement.clientWidth, shell: rect('.app-shell'), main: rect('.app-main'), rail: rect('.channel-rail'), editor: rect('.markdown-editor-page') }
})
await page.locator('.markdown-editor-page .content-heading .arco-btn').click()
await page.locator('.channel-rail button[title="AI"]').click()
await page.waitForSelector('.expert-chips')
const experts = await page.locator('.expert-chips span').count()
@@ -83,8 +93,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 (experts !== 1) failures.push(`expected one AI expert, got ${experts}`)
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, experts, taskModal, exploreSources, exploreDetail, profileMenu, errors }, null, 2))
console.log(JSON.stringify({ home, documents, documentActions, markdownEditor, markdownLayout, experts, taskModal, exploreSources, exploreDetail, profileMenu, errors }, null, 2))
if (failures.length) throw new Error(failures.join('\n'))