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.
This commit is contained in:
@@ -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'))
|
||||
})
|
||||
@@ -46,8 +46,12 @@ async function openReaderOnDoc(page: Page, title: string) {
|
||||
test.describe.serial('I4 文档驾驶舱组合验收', () => {
|
||||
// 场景 1:首次进入项目——统计带、结构树、全景可见(DV-R01/R02)。
|
||||
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 openCockpit(page)
|
||||
test.info().annotations.push({ type: 'debug', description: dbg.join(' | ') || '(no cockpit console)' })
|
||||
// placeholder
|
||||
await expect(page.locator('.cockpit-stat', { hasText: '完成度' })).toBeVisible()
|
||||
await expect(page.locator('.cockpit-stat', { hasText: '文档' })).toBeVisible()
|
||||
|
||||
@@ -63,13 +63,16 @@ export function DocumentCockpit() {
|
||||
// 项目清单(rdm.project.list:成员可见项目,canAudit 与否不影响文档读取入口)。
|
||||
useEffect(() => {
|
||||
let c = false
|
||||
console.log('[cockpit-dbg] effect start identity=', identity)
|
||||
setProjects(null); setPid(''); setOverview(null); setSelected(null); setFilter(''); setError('')
|
||||
api.rdmCommand<{ projects?: ProjectView[] } | ProjectView[]>('rdm.project.list')
|
||||
.then(list => {
|
||||
const rows = Array.isArray(list) ? list : (list?.projects ?? [])
|
||||
console.log('[cockpit-dbg] resolved cancelled=', c, 'rows=', rows?.length)
|
||||
if (!c) return
|
||||
// rdm.project.list 返回 { projects: [...] };容忍裸数组形态。
|
||||
const rows = Array.isArray(list) ? list : (list?.projects ?? [])
|
||||
setProjects(rows)
|
||||
console.log('[cockpit-dbg] setProjects done')
|
||||
})
|
||||
.catch(e => { if (!c) setError(e.message) })
|
||||
return () => { c = true }
|
||||
|
||||
Reference in New Issue
Block a user