test(e2e): LOD 用例让 fit 落在 lite 区间,断言跟随实测 scale
根因(3 条同一原因,测试假设过期,非产品缺陷): - 用例用 40 列 × 200px 铺开,注释写「fit ≈0.18 ≥ 15% ⇒ 必须是 lite」; - 停靠栏把可用宽度从 ~1384 压到 ~1014 后,实测 fit = 0.127(<15%) ⇒ 应用按设计整片降成 plain(300 个 .iwb-lod-plain),lite 断言全部失效。 - 实测对照:40 列 → scale 0.127 / plain 300;24 列 → scale 0.213 / lite 300。 修法: 1. COLS 40 → 24:fit ≈0.213,既 <64px/节点(触发 LOD)又 ≥15%(应为 lite),三个方向都还能守。 2. ① 的档位断言改为跟随实测 scale(<15% ⇒ 期望 plain,≥15% ⇒ 期望 lite), 避免以后视口/停靠栏再变时静默失效。 验证:iwb-lod 5/5 全绿(此前 3 红);基线已知红 20 → 17 条。
This commit is contained in:
1 parent
c16068be2a
commit
319598ef65
2 files changed
+11
-14
No files matched your search
Vendored
+2
-10
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"$comment": "e2e 已知失败清单。用途:把「长期红」与「新红」分开,避免门禁信号被噪声淹没。维护:修好一条就删一条;新红由 scripts/e2e-known-red-report.js 报出来。kind=unknown 表示尚未逐条判定。退役清单见 retired。 2026-11-27 追记:iwb-picker 9/9 已修复(初始默认视口被误持久化导致 doFit 被跳过),已移出清单。 2026-11-27 追记:iwb-private-gate 4 条(.iwb-ctxmenu 未排除子菜单 + 设置页默认页变化)与 iwb-connect-menu ⑤(同一 strict 问题)已修,移出清单。",
|
||||
"$comment": "e2e 已知失败清单。用途:把「长期红」与「新红」分开,避免门禁信号被噪声淹没。维护:修好一条就删一条;新红由 scripts/e2e-known-red-report.js 报出来。kind=unknown 表示尚未逐条判定。退役清单见 retired。 2026-11-27 追记:iwb-picker 9/9 已修复(初始默认视口被误持久化导致 doFit 被跳过),已移出清单。 2026-11-27 追记:iwb-private-gate 4 条(.iwb-ctxmenu 未排除子菜单 + 设置页默认页变化)与 iwb-connect-menu ⑤(同一 strict 问题)已修,移出清单。 2026-11-27 追记:iwb-lod 3 条已修(列数 40→24,让 fit 落在 lite 区间;断言改为跟随实测 scale),移出清单。",
|
||||
"measuredAt": "2026-11-27",
|
||||
"measuredVersion": "3.26.107",
|
||||
"measuredCommit": "64f37e1",
|
||||
@@ -7,7 +7,7 @@
|
||||
"specs": 52,
|
||||
"tests": 195,
|
||||
"passed": 162,
|
||||
"failed": 20
|
||||
"failed": 17
|
||||
},
|
||||
"baseUrl": {
|
||||
"clipboard-audit": "http://127.0.0.1:8799",
|
||||
@@ -62,14 +62,6 @@
|
||||
"reason": "收藏节点组原图快照用例超时,待定位",
|
||||
"since": "2026-11-27 实测"
|
||||
},
|
||||
{
|
||||
"spec": "tests/iwb-lod.spec.js",
|
||||
"knownFailures": 3,
|
||||
"total": 5,
|
||||
"kind": "unknown",
|
||||
"reason": "LOD 阈值相关断言失败,可能与取景缩放变化有关,待判定",
|
||||
"since": "2026-11-27 实测"
|
||||
},
|
||||
{
|
||||
"spec": "tests/iwb-resize-perf.spec.js",
|
||||
"knownFailures": 1,
|
||||
|
||||
@@ -16,7 +16,10 @@ const { poll, waitHomeReady, waitCanvasOpen } = require('./_helpers/wait')
|
||||
test.use({ baseURL: process.env.IWB_BASE_URL || 'http://127.0.0.1:8787', viewport: { width: 1440, height: 1000 } })
|
||||
|
||||
const CFG = { providers: [{ id: 'p-a', name: 'A', baseUrl: 'https://a.example/v1', keys: [{ id: 'a-1', name: 'K', value: 'sk' }], models: [{ name: 'gpt-image-2.5', visible: true }] }], canvas: { snap: true } }
|
||||
const COLS = 40
|
||||
// 2026-11-27:列数从 40 降到 24。停靠栏把可用宽度从 ~1384 压到 ~1014,
|
||||
// 40 列的 fit 从 0.18 掉到 0.127(<15%)⇒ 按设计整片降成 plain,本 spec 的 lite 断言随之失效。
|
||||
// 24 列 fit ≈0.213:既 <64px/节点(触发 LOD),又 ≥15%(应为 lite)。
|
||||
const COLS = 24
|
||||
// 1×1 红点(data URL,无需网络):用来验证 lite 档真的把「代表图」画出来了
|
||||
const DOT = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg=='
|
||||
|
||||
@@ -65,9 +68,11 @@ test('大画布 fit 视图:节点屏幕宽 < 64px 时降级,不挂 textarea'
|
||||
await poll(page, () => readScale(page), { timeout: 20000 }).toBeLessThan(0.24)
|
||||
// 160 × 0.24 = 38px,远低于 64px 阈值
|
||||
await poll(page, () => page.locator('.iwb-node-body-lod').count(), { timeout: 20000 }).toBe(300)
|
||||
// fit ≈0.18 ≥ 15% ⇒ 必须是 lite(有内容),**不许**直接灰块(用户实测反馈过这一点)
|
||||
await expect(page.locator('.iwb-lod-plain'), '15% 以上不该出现纯占位').toHaveCount(0)
|
||||
await expect(page.locator('.iwb-lod-lite'), 'fit 视图应全部是 lite 档').toHaveCount(300)
|
||||
// 断言跟随实测 scale(不再假设固定档位):<15% ⇒ plain,≥15% ⇒ lite(有内容,不许灰块)
|
||||
const fitScale = await readScale(page)
|
||||
const wantPlain = fitScale < 0.15
|
||||
await expect(page.locator('.iwb-lod-plain'), '低于 15% 才允许纯占位(当前 ' + fitScale.toFixed(3) + ')').toHaveCount(wantPlain ? 300 : 0)
|
||||
await expect(page.locator('.iwb-lod-lite'), '15% 以上必须是 lite(当前 ' + fitScale.toFixed(3) + ')').toHaveCount(wantPlain ? 0 : 300)
|
||||
await expect(page.locator('.iwb-node textarea'), 'fit 视图不该渲染任何 textarea').toHaveCount(0)
|
||||
await expect(page.locator('.iwb-node .iwb-node-body').first()).toBeVisible()
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user