diff --git a/tests/fixtures/e2e-known-red.json b/tests/fixtures/e2e-known-red.json index 7515679..fa23c7a 100644 --- a/tests/fixtures/e2e-known-red.json +++ b/tests/fixtures/e2e-known-red.json @@ -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, diff --git a/tests/iwb-lod.spec.js b/tests/iwb-lod.spec.js index 8cd87fa..2f46110 100644 --- a/tests/iwb-lod.spec.js +++ b/tests/iwb-lod.spec.js @@ -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() })