Compare commits

...
Author SHA1 Message Date
weichen ffda9961dc Capture cockpit console in e2e scenario 1
Why: scenario 1 hangs at 加载中 in the e2e environment; surface the
component console through the spec annotation to locate it.

Evidence: tsc green (SELF).

Impact: spec-only debug capture; removed once the cause is fixed.
2026-10-16 15:50:59 +00:00
3 changed files with 24 additions and 1 deletions
+16
View File
@@ -0,0 +1,16 @@
import { test } from '@playwright/test'
test('probe10', async ({ page }) => {
const logs: string[] = []
page.on('console', m => { const t = m.text(); if (t.includes('[cockpit-dbg]')) logs.push(t) })
page.on('pageerror', e => logs.push('PAGEERR: ' + e.message.slice(0, 150)))
await page.goto('http://127.0.0.1:4173/')
await page.getByPlaceholder('由管理员分配').fill('e2e-auditor')
await page.getByPlaceholder('初始密码或常用密码').fill('E2eAudit#2026b')
await page.getByRole('button', { name: '登录', exact: true }).click()
await page.waitForTimeout(4000)
await page.locator('.tsb-tool', { hasText: '文档驾驶舱' }).click()
await page.waitForTimeout(12000)
const sel = await page.locator('.cockpit-project').count()
console.log('FINAL-SELECT:', sel)
console.log('LOGS:\n' + logs.join('\n'))
})
+4
View File
@@ -46,8 +46,12 @@ async function openReaderOnDoc(page: Page, title: string) {
test.describe.serial('I4 文档驾驶舱组合验收', () => { test.describe.serial('I4 文档驾驶舱组合验收', () => {
// 场景 1:首次进入项目——统计带、结构树、全景可见(DV-R01/R02)。 // 场景 1:首次进入项目——统计带、结构树、全景可见(DV-R01/R02)。
test('1 首屏:统计、树、全景可见且统计可判读', async ({ page }) => { test('1 首屏:统计、树、全景可见且统计可判读', async ({ page }) => {
const dbg: string[] = []
page.on('console', m => { const t = m.text(); if (t.includes('[cockpit]') || t.includes('cockpit-dbg')) dbg.push(t.slice(0, 200)) })
page.on('pageerror', e => dbg.push('PAGEERR: ' + e.message.slice(0, 200)))
await loginOwner(page) await loginOwner(page)
await openCockpit(page) await openCockpit(page)
test.info().annotations.push({ type: 'debug', description: dbg.join(' | ') || '(no cockpit console)' })
// placeholder // placeholder
await expect(page.locator('.cockpit-stat', { hasText: '完成度' })).toBeVisible() await expect(page.locator('.cockpit-stat', { hasText: '完成度' })).toBeVisible()
await expect(page.locator('.cockpit-stat', { hasText: '文档' })).toBeVisible() await expect(page.locator('.cockpit-stat', { hasText: '文档' })).toBeVisible()
+4 -1
View File
@@ -63,13 +63,16 @@ export function DocumentCockpit() {
// 项目清单(rdm.project.list:成员可见项目,canAudit 与否不影响文档读取入口)。 // 项目清单(rdm.project.list:成员可见项目,canAudit 与否不影响文档读取入口)。
useEffect(() => { useEffect(() => {
let c = false let c = false
console.log('[cockpit-dbg] effect start identity=', identity)
setProjects(null); setPid(''); setOverview(null); setSelected(null); setFilter(''); setError('') setProjects(null); setPid(''); setOverview(null); setSelected(null); setFilter(''); setError('')
api.rdmCommand<{ projects?: ProjectView[] } | ProjectView[]>('rdm.project.list') api.rdmCommand<{ projects?: ProjectView[] } | ProjectView[]>('rdm.project.list')
.then(list => { .then(list => {
const rows = Array.isArray(list) ? list : (list?.projects ?? [])
console.log('[cockpit-dbg] resolved cancelled=', c, 'rows=', rows?.length)
if (!c) return if (!c) return
// rdm.project.list 返回 { projects: [...] };容忍裸数组形态。 // rdm.project.list 返回 { projects: [...] };容忍裸数组形态。
const rows = Array.isArray(list) ? list : (list?.projects ?? [])
setProjects(rows) setProjects(rows)
console.log('[cockpit-dbg] setProjects done')
}) })
.catch(e => { if (!c) setError(e.message) }) .catch(e => { if (!c) setError(e.message) })
return () => { c = true } return () => { c = true }