Files
workspace/code/g3soft-libs/packages/ui/probe-which.mjs
T
2026-10-15 17:31:35 +08:00

42 lines
1.3 KiB
JavaScript

import { chromium } from '@playwright/test'
// 直接确认:dev server 吐给浏览器的 G3Table.vue 里,到底有没有新判据。
const BASE = process.env.PROBE_URL || 'http://localhost:5200'
const browser = await chromium.launch()
const page = await browser.newPage({ viewport: { width: 1400, height: 1200 } })
const seen = []
page.on('response', async (res) => {
const u = res.url()
if (u.includes('G3Table.vue')) {
try {
const t = await res.text()
seen.push({
url: u.split('?')[0],
hasNew: t.includes('innerBottom - 1'),
hasOld: t.includes('used + bodyH >= available'),
len: t.length,
})
} catch {}
}
})
await page.goto(BASE, { waitUntil: 'networkidle' })
await page.waitForTimeout(800)
console.log('=== G3Table.vue responses seen by browser ===')
console.log(JSON.stringify(seen, null, 2))
// 再看页面里 is-body-fill 的实际状态,以及 measureBodyFill 是否存在新逻辑
const probe = await page.evaluate(() => {
const wrap = document.querySelector('[data-testid="table-wrap"]')
const root = wrap.querySelector('.g3-table')
return {
isBodyFill: root.classList.contains('is-body-fill'),
wrapH: Math.round(wrap.getBoundingClientRect().height),
}
})
console.log('page state:', JSON.stringify(probe))
await browser.close()