docs/e2e/dag-{panel.html,panel.mjs,data.mjs,panel.sh}
- 端口 7789,复用 lib/{exec,env,dsl,cipher}.mjs
- 5 张图共 71 节点全部跑通,真实业务链路+上下文传递
- Actions 引擎:pickSpace/search/openCreate/fillForm/save/toast/rowAction
- 节点 mode 徽章 + step 数徽章 + 侧栏 4 块详情(入参/产出/ctx/Chrome DOM)
- 每节点 actions 序列真实执行+每步截图,42 action-step/图1 全部 pass
- Business flowCtx: demandId→contractId→sandboxId→settlementId→auditId
- 签约 signCostMs=2ms, 满足 ≤1s SLA
- 新增 docs/e2e/DAG演示.command Finder 双击入口
- 清理废弃 web/nax_e2e_smoke.cjs / web/verify_new_pages.cjs
memory 2026-08-08: 记录 v1~v7 全部迭代与踩坑
146 lines
6.7 KiB
JavaScript
146 lines
6.7 KiB
JavaScript
// 临时探针:登录后访问 sswflow 页面,复现三个问题
|
||
export const meta = { tc: '_web_sswflow_probe', title: 'web/ sswflow 三个 UI 问题探针' }
|
||
export async function run(t) {
|
||
// 监听所有 /api/ 响应,记录 600 / 401 等异常
|
||
t.page.on('response', async (resp) => {
|
||
const url = resp.url()
|
||
if (!url.includes('/api/')) return
|
||
if (resp.status() === 401 || resp.status() >= 500) {
|
||
console.log(' [NET]', resp.status(), resp.request().method(), url.slice(0, 100))
|
||
}
|
||
// 读 body 拿 code
|
||
try {
|
||
const ct = (resp.headers()['content-type'] || '').toLowerCase()
|
||
if (ct.includes('json')) {
|
||
const body = await resp.json().catch(() => null)
|
||
if (body && body.code !== undefined && body.code !== 200 && body.code !== 600) {
|
||
console.log(' [API]', resp.status(), resp.request().method(), url.slice(0, 80), 'code=', body.code, 'msg=', (body.msg || '').slice(0, 80))
|
||
} else if (body && body.code === 600) {
|
||
console.log(' [API-600!]', resp.request().method(), url.slice(0, 80), 'msg=', (body.msg || '').slice(0, 80))
|
||
}
|
||
}
|
||
} catch {}
|
||
})
|
||
t.page.on('console', (m) => {
|
||
if (m.type() === 'warning' || m.type() === 'error') {
|
||
const t2 = m.text()
|
||
if (!/favicon|net::ERR_|Failed to load resource|connecting|connected/.test(t2)) {
|
||
console.log(' [CONSOLE', m.type(), ']', t2.slice(0, 200))
|
||
}
|
||
}
|
||
})
|
||
await t.login()
|
||
|
||
// 准备一个带真实画布的 flow(8 节点 + 8 边),用于验证问题 2(节点属性点击)和问题 3(节点堆在一起)
|
||
const { jointCanvas, ensureFlow, ensureScene, ensureDatasetAuth, PROJECT_NAME, JOIN_KEY, LABEL_COLUMN } = await import('../lib/riskctrl.mjs')
|
||
const ids = await ensureScene(t)
|
||
const projectId = ids.projectId
|
||
// 授权两个数据集给项目(确保后续引擎能拉到)
|
||
for (const key of Object.keys(ids.dataset || {})) {
|
||
const dsId = ids.dataset[key]
|
||
const partyIds = Object.values(ids.party || {})
|
||
try { await ensureDatasetAuth(t, dsId, ids.projectId, partyIds) } catch (e) { console.log('auth warn', key, e.message) }
|
||
}
|
||
const flowId = await ensureFlow(t, projectId, `探针-${t.runId}`, jointCanvas(ids))
|
||
console.log('created flowId=', flowId)
|
||
|
||
// 问题 1:链接点击自动跳 tds/space
|
||
await t.goto('/flow/home')
|
||
await t.page.waitForTimeout(800)
|
||
await t.expectVisible('平台概览', 'Home 已渲染')
|
||
await t.page.locator('.card').first().click()
|
||
await t.page.waitForTimeout(1500)
|
||
const urlAfterCard = t.page.url()
|
||
console.log('after click first card, url=', urlAfterCard)
|
||
t.assert(urlAfterCard.includes('/flow/'), `首页卡片点击跳到 sswflow 子路由(实际 ${urlAfterCard},未跳到 tds/spaces)`)
|
||
await t.shot('probe-1-card-click')
|
||
|
||
// 回到 home 后重新跳 editor
|
||
await t.goto('/flow/home')
|
||
await t.page.waitForTimeout(500)
|
||
// 列出所有 .card 看哪个是最后一个
|
||
const cardInfo = await t.page.evaluate(() => {
|
||
const cards = Array.from(document.querySelectorAll('.card'))
|
||
const tok = Object.keys(localStorage).filter(k => k.includes('ssw_'))
|
||
return {
|
||
cards: cards.map((c, i) => ({
|
||
idx: i,
|
||
text: (c.textContent || '').trim().slice(0, 60),
|
||
cls: c.className,
|
||
})),
|
||
tokens: tok,
|
||
ssw_token: localStorage.getItem('ssw_token_sswflow') ? 'present' : 'missing',
|
||
}
|
||
})
|
||
console.log('cards on home:', JSON.stringify(cardInfo))
|
||
// 点最后一张卡片(流程)
|
||
await t.page.locator('.card').last().click()
|
||
await t.page.waitForTimeout(1500)
|
||
console.log('after click last card (flow), url=', t.page.url())
|
||
await t.shot('probe-1-card-flow')
|
||
|
||
// 问题 3 + 2:访问带真实画布的 editor
|
||
// 先直接 goto 看是否能落到 editor
|
||
console.log('about to goto /flow/editor?flowId=' + flowId)
|
||
// 用 page.goto 直接全页面加载(不走 t.goto 的 waitFor ant-table)
|
||
await t.page.goto(`http://localhost:5173/flow/editor?flowId=${flowId}`, { waitUntil: 'domcontentloaded' })
|
||
await t.page.waitForTimeout(4000)
|
||
console.log('after goto, url=', t.page.url())
|
||
// dump token + routes after
|
||
const after = await t.page.evaluate(() => ({
|
||
url: location.href,
|
||
token: localStorage.getItem('ssw_token_sswflow'),
|
||
tokenValue: (localStorage.getItem('ssw_token_sswflow') || '').slice(0, 50),
|
||
}))
|
||
console.log('after state:', JSON.stringify(after))
|
||
const info = await t.page.evaluate(() => {
|
||
const nodes = Array.from(document.querySelectorAll('.ssw-node'))
|
||
return {
|
||
hasFlow: !!document.querySelector('.vue-flow'),
|
||
sswNodesCount: nodes.length,
|
||
sswNodesRect: nodes.slice(0, 10).map(n => {
|
||
const r = n.getBoundingClientRect()
|
||
return { left: Math.round(r.left), top: Math.round(r.top), w: Math.round(r.width) }
|
||
}),
|
||
hasRight: !!document.querySelector('.right'),
|
||
hasCfgEmpty: !!document.querySelector('.cfg-empty'),
|
||
hasCfgDrawer: !!document.querySelector('.cfg-drawer'),
|
||
rightBox: (() => {
|
||
const r = document.querySelector('.right')
|
||
if (!r) return null
|
||
const b = r.getBoundingClientRect()
|
||
return { w: Math.round(b.width), h: Math.round(b.height) }
|
||
})(),
|
||
vueFlowViewport: document.querySelector('.vue-flow__viewport')?.style.transform || '(none)',
|
||
vueFlowSize: (() => {
|
||
const f = document.querySelector('.vue-flow')
|
||
if (!f) return null
|
||
const r = f.getBoundingClientRect()
|
||
return { w: Math.round(r.width), h: Math.round(r.height) }
|
||
})(),
|
||
}
|
||
})
|
||
console.log('editor info:', JSON.stringify(info, null, 2))
|
||
t.assert(info.sswNodesCount >= 8, `editor 加载 8 节点画布(实际 ${info.sswNodesCount})`)
|
||
// 检查节点是否散开
|
||
const positions = info.sswNodesRect.map(n => `${n.left},${n.top}`)
|
||
const uniquePositions = new Set(positions)
|
||
t.assert(uniquePositions.size >= 8, `8 节点位置不重叠(唯一坐标=${uniquePositions.size})`)
|
||
await t.shot('probe-2-editor')
|
||
|
||
// 问题 2:点节点看右侧 drawer
|
||
if (info.sswNodesCount > 0) {
|
||
await t.page.locator('.ssw-node').first().click()
|
||
await t.page.waitForTimeout(800)
|
||
const after = await t.page.evaluate(() => ({
|
||
hasCfgDrawer: !!document.querySelector('.cfg-drawer'),
|
||
hasCfgEmpty: !!document.querySelector('.cfg-empty'),
|
||
drawerVisible: !!document.querySelector('.cfg-drawer .form-item, .cfg-drawer input, .cfg-drawer textarea'),
|
||
rightChildren: document.querySelector('.right')?.children?.length || 0,
|
||
}))
|
||
console.log('after node click:', after)
|
||
t.assert(after.hasCfgDrawer, `点击节点后 cfg-drawer 渲染(hasCfgDrawer=${after.hasCfgDrawer})`)
|
||
t.assert(!after.hasCfgEmpty, `点击节点后 cfg-empty 隐藏(hasCfgEmpty=${after.hasCfgEmpty})`)
|
||
await t.shot('probe-2-after-node-click')
|
||
}
|
||
} |