From 3e3ae655d3bfd848139cabbeabab166e8bd05e5c Mon Sep 17 00:00:00 2001 From: qiqi Date: Fri, 27 Nov 2026 06:37:07 +0800 Subject: [PATCH] =?UTF-8?q?test(e2e):=20=E5=8F=B3=E9=94=AE=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E6=96=AD=E8=A8=80=E6=94=B6=E7=AA=84=E5=88=B0=E4=B8=BB?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=EF=BC=9B=E8=AE=BE=E7=BD=AE=E9=A1=B5=E8=A1=A5?= =?UTF-8?q?=E5=88=87=E3=80=8C=E7=94=9F=E5=9B=BE=E6=9C=8D=E5=8A=A1=E3=80=8D?= =?UTF-8?q?=EF=BC=88private-gate=204=20=E6=9D=A1=20+=20connect-menu=20?= =?UTF-8?q?=E2=91=A4=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因(4+1 条同一族):右键菜单是「主菜单 + 子菜单」两层,两者都带 .iwb-ctxmenu, 裸选择器在 strict mode 下命中 2 个元素 ⇒ toBeVisible 直接失败。 - private-gate:openCtxMenu / layerCtxItem 改用 .iwb-ctxmenu:not(.iwb-ctx-sub) - connect-menu ⑤:同样收窄(与 canvas-ops 里既有写法一致) 另:设置面板默认页已是「通用」,分层模型区块在「生图服务」页 ⇒ 补一次切页; 区块标题由「分层模型(…)」简化为「分层模型」,断言改用 .iwb-gset-group-h。 验证:private-gate 4/4 + connect-menu 9/9 全绿(此前 4 + 1 红)。 基线:已知红 25 → 20 条。 --- tests/fixtures/e2e-known-red.json | 20 ++------------------ tests/iwb-connect-menu.spec.js | 6 ++++-- tests/iwb-private-gate.spec.js | 10 +++++++--- 3 files changed, 13 insertions(+), 23 deletions(-) diff --git a/tests/fixtures/e2e-known-red.json b/tests/fixtures/e2e-known-red.json index 6da47d3..7515679 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 被跳过),已移出清单。", + "$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 问题)已修,移出清单。", "measuredAt": "2026-11-27", "measuredVersion": "3.26.107", "measuredCommit": "64f37e1", @@ -7,7 +7,7 @@ "specs": 52, "tests": 195, "passed": 162, - "failed": 25 + "failed": 20 }, "baseUrl": { "clipboard-audit": "http://127.0.0.1:8799", @@ -30,14 +30,6 @@ "reason": "flush 语义用例超时(2026-11-24 起长期红,尚未定位)", "since": "2026-11-27 实测" }, - { - "spec": "tests/iwb-connect-menu.spec.js", - "knownFailures": 1, - "total": 9, - "kind": "defect", - "reason": "⑤ .iwb-ctxmenu 同时命中主菜单与子菜单(strict mode),选择器需收窄", - "since": "2026-11-27 实测" - }, { "spec": "tests/iwb-download-cors.spec.js", "knownFailures": 1, @@ -78,14 +70,6 @@ "reason": "LOD 阈值相关断言失败,可能与取景缩放变化有关,待判定", "since": "2026-11-27 实测" }, - { - "spec": "tests/iwb-private-gate.spec.js", - "knownFailures": 4, - "total": 4, - "kind": "unknown", - "reason": "分层/润色入口的可见性断言失败,疑似入口位置随停靠栏布局变化", - "since": "2026-11-27 实测" - }, { "spec": "tests/iwb-resize-perf.spec.js", "knownFailures": 1, diff --git a/tests/iwb-connect-menu.spec.js b/tests/iwb-connect-menu.spec.js index 3a6aba2..315f1b0 100644 --- a/tests/iwb-connect-menu.spec.js +++ b/tests/iwb-connect-menu.spec.js @@ -180,8 +180,10 @@ test('⑤ 分层/润色默认隐藏:底栏与右键菜单都没有新建入口 // 右键菜单 const canvas = await page.locator('.iwb-canvas').boundingBox() await page.mouse.click(canvas.x + canvas.width * 0.5, canvas.y + canvas.height * 0.5, { button: 'right' }) - await expect(page.locator('.iwb-ctxmenu')).toBeVisible({ timeout: 8000 }) - const items = await page.locator('.iwb-ctxmenu .iwb-ctx-item').evaluateAll((els) => els.map((e) => (e.textContent || '').trim())) + // 2026-11-27:主菜单与子菜单都带 .iwb-ctxmenu ⇒ 收窄到主菜单(否则 strict mode 命中 2 个) + const MAIN_CTX = '.iwb-ctxmenu:not(.iwb-ctx-sub)' + await expect(page.locator(MAIN_CTX)).toBeVisible({ timeout: 8000 }) + const items = await page.locator(MAIN_CTX + ' .iwb-ctx-item').evaluateAll((els) => els.map((e) => (e.textContent || '').trim())) expect(items.some((t) => t.includes('润色')), '右键菜单默认不应有「润色」').toBe(false) expect(items.some((t) => t.includes('分层')), '右键菜单默认不应有「分层」').toBe(false) // 但常规节点仍在 diff --git a/tests/iwb-private-gate.spec.js b/tests/iwb-private-gate.spec.js index 544c846..6993307 100644 --- a/tests/iwb-private-gate.spec.js +++ b/tests/iwb-private-gate.spec.js @@ -43,12 +43,14 @@ async function ensureCanvas(page) { await page.waitForTimeout(200) } +// 2026-11-27:右键菜单是「主菜单 + 子菜单」两层,两者都带 .iwb-ctxmenu ⇒ 必须排除子菜单 +const MAIN_CTX = '.iwb-ctxmenu:not(.iwb-ctx-sub)' async function openCtxMenu(page) { await ensureCanvas(page) await page.locator('.iwb-canvas').click({ button: 'right', position: { x: 900, y: 620 } }) - await expect(page.locator('.iwb-ctxmenu')).toBeVisible() + await expect(page.locator(MAIN_CTX)).toBeVisible() } -const layerCtxItem = (page) => page.locator('.iwb-ctxmenu .iwb-ctx-item', { hasText: '分层' }) +const layerCtxItem = (page) => page.locator(MAIN_CTX + ' .iwb-ctx-item', { hasText: '分层' }) test('默认隐藏:无开关时右键菜单与设置面板都没有分层入口', async ({ page }) => { const errors = [] @@ -79,7 +81,9 @@ test('链接暗号:开启后入口出现且地址栏不留痕,off 可关闭' await expect(layerCtxItem(page)).toHaveCount(1) await page.keyboard.press('Escape') await page.locator('.iwb-navrail .iwb-nav-item[title="设置"]').click() - await expect(page.locator('.iwb-settings-modal').getByText(/分层模型(/)).toBeVisible() + // 2026-11-27:设置默认页是「通用」,分层模型区块在「生图服务」页的服务商卡片里 + await page.locator('.iwb-settings-modal .iwb-tab').filter({ hasText: '生图服务' }).first().click() + await expect(page.locator('.iwb-settings-modal .iwb-gset-group-h').filter({ hasText: '分层模型' }).first()).toBeVisible() await page.locator('.iwb-modal-head button[title="关闭"]').click() // ② off 关闭:入口重新消失