- BS-5: 仅 ctx 完全缺失时阻塞, 不再因 existingEnCodes.length===0 误报 (场景: 全删 form 后重建, AppContext 仍有但 list 空, 旧逻辑会无限循环阻断) - BS-47: 仅 dict typeCreate 命令触发, 不再在 menu create 时误判 (场景: menu enCode 与 form enCode 共享合法, 但 BS-47 把 form enCode 看作 dict 冲突) Co-Authored-By: Claude <[email protected]>
60 lines
2.6 KiB
JavaScript
60 lines
2.6 KiB
JavaScript
// tds1 浏览器层深度 debug — 抓 console + network + DOM
|
|
import { chromium } from 'playwright'
|
|
|
|
const browser = await chromium.launch({ headless: true })
|
|
const page = await browser.newPage({ viewport: { width: 1440, height: 900 } })
|
|
|
|
const consoleMessages = []
|
|
const networkErrors = []
|
|
page.on('console', msg => consoleMessages.push({ type: msg.type(), text: msg.text() }))
|
|
page.on('pageerror', err => consoleMessages.push({ type: 'pageerror', text: err.message }))
|
|
page.on('response', resp => {
|
|
if (resp.status() >= 400) networkErrors.push({ url: resp.url(), status: resp.status() })
|
|
})
|
|
|
|
try {
|
|
await page.goto('http://nginx/', { waitUntil: 'domcontentloaded', timeout: 30000 })
|
|
await page.waitForTimeout(2000)
|
|
await page.locator('input[placeholder*="账号"], input[placeholder*="账户"]').first().fill('admin')
|
|
await page.locator('input[type="password"]').first().fill('123456')
|
|
await page.locator('button:has-text("登录"), button:has-text("登 录")').first().click()
|
|
await page.waitForTimeout(5000)
|
|
|
|
// 直接到 tds_space_v3
|
|
await page.goto('http://nginx/jnpf_app_tds1/model/tds_space_v3', { waitUntil: 'domcontentloaded', timeout: 30000 })
|
|
await page.waitForTimeout(10000)
|
|
|
|
// 检查 DOM
|
|
const dom = await page.evaluate(() => {
|
|
return {
|
|
bodyHTML: document.body.innerHTML.slice(0, 5000),
|
|
vxeTable: document.querySelectorAll('.vxe-table').length,
|
|
antTable: document.querySelectorAll('.ant-table').length,
|
|
labels: Array.from(document.querySelectorAll('label, .label, .col-form-label')).map(l => l.textContent?.trim()).filter(Boolean).slice(0, 20),
|
|
buttons: Array.from(document.querySelectorAll('button')).map(b => b.textContent?.trim()).filter(Boolean).slice(0, 10),
|
|
mainContent: document.querySelector('.jnpf-content, .main-content, [class*="container"]')?.innerHTML?.slice(0, 1000) || 'none',
|
|
}
|
|
})
|
|
|
|
console.log('=== DOM 检查 ===')
|
|
console.log('vxe-table 数:', dom.vxeTable)
|
|
console.log('ant-table 数:', dom.antTable)
|
|
console.log('labels:', JSON.stringify(dom.labels))
|
|
console.log('buttons:', JSON.stringify(dom.buttons))
|
|
console.log('main content 前 1000:', dom.mainContent)
|
|
|
|
console.log('\n=== Console Messages ===')
|
|
for (const m of consoleMessages.slice(0, 30)) {
|
|
console.log(` [${m.type}] ${m.text.slice(0, 200)}`)
|
|
}
|
|
|
|
console.log('\n=== Network Errors (4xx/5xx) ===')
|
|
for (const e of networkErrors.slice(0, 30)) {
|
|
console.log(` ${e.status} ${e.url}`)
|
|
}
|
|
|
|
await page.screenshot({ path: '/home/ubuntu/ccWorkDir/docs/tds1/screenshots/debug_tds_space.png', fullPage: true })
|
|
} finally {
|
|
await browser.close()
|
|
}
|