test(image-annotate): 真站 e2e 跟上 v1.13 改动(层级按钮删除 / 视图按钮归位 / 快捷键排序)

原 4.6 段还在点 `.iwb-editor-layer-btn[data-layer=down]`,按钮已删会一直等到 30s 超时。
改为:断言顶栏层级按钮数为 0、工具栏末两个子元素是 zoomFit/togglePanels,
排序部分改用 Ctrl+[ / Ctrl+] / Ctrl+Shift+[ / Ctrl+Shift+] 验证,
并新增一条「置底后原图不再被钉在最底」—— 实测输出 矩形 > 原图 > 图层 2,
即被置底的那层压到了原图下面,解封生效。

真站 e2e 全通过(含 SRI / CSP 段)。
This commit is contained in:
qiqi committed 2026-11-08 22:29:45 +08:00
1 parent 31866a2407
commit bf32ec6ddb
1 file changed
+25 -9
+25 -9
View File
@@ -176,18 +176,34 @@ if (!SKIP_PASTE) {
check('点击「截图+图形」重叠区选中最上层截图(不被下方图形抢走)',
Boolean(activeItem && activeItem.type === 'bitmap' && /图层/.test(activeItem.name)), JSON.stringify(activeItem))
// v1.13 起顶栏四个层级按钮已删除(改为图层拖动 + Ctrl+]/[ 快捷键),
// 这里改为断言「按钮确实没了」+ 用快捷键验证排序仍然可用。
check('顶栏不再有层级排序按钮(改用图层拖动 + Ctrl+]/[)',
(await page.locator('.iwb-editor-layer-btn').count()) === 0 &&
(await page.locator('.iwb-editor-header .iwb-editor-commands').count()) === 0,
'layerBtn=' + await page.locator('.iwb-editor-layer-btn').count())
const toolsTail = await page.evaluate(() => Array.from(document.querySelectorAll('.iwb-editor-tools > *'))
.slice(-2).map((n) => n.dataset.action || n.className))
check('工具栏最右两个按钮是「适应窗口 / 收起侧栏」',
JSON.stringify(toolsTail) === JSON.stringify(['zoomFit', 'togglePanels']), JSON.stringify(toolsTail))
const before = await panelSeq()
await page.locator('.iwb-editor-layer-btn[data-layer="down"]').click()
const activeName = await page.evaluate(() => document.querySelector('.iwb-editor-layer-list .iwb-layer-item.active .iwb-layer-name')?.textContent)
await page.keyboard.press('Control+[') // 下移一层
const afterDown = await panelSeq()
check('「下移一层」改变图层顺序', before !== afterDown, before + ' → ' + afterDown)
await page.locator('.iwb-editor-layer-btn[data-layer="up"]').click()
check('「上移一层」恢复原顺序', (await panelSeq()) === before, await panelSeq())
await page.locator('.iwb-editor-layer-btn[data-layer="bottom"]').click()
check('Ctrl+[ 下移一层改变图层顺序', before !== afterDown, before + ' → ' + afterDown)
await page.keyboard.press('Control+]') // 上移一层
check('Ctrl+] 上移一层恢复原顺序', (await panelSeq()) === before, await panelSeq())
await page.keyboard.press('Control+Shift+[') // 置底
const afterBottom = await panelSeq()
check('「置底」生效且原图仍在最底(元素不会消失)',
afterBottom !== before && afterBottom.endsWith('原图'), afterBottom)
await page.locator('.iwb-editor-layer-btn[data-layer="top"]').click()
check('「置顶」生效', (await panelSeq()) !== afterBottom, await panelSeq())
check('Ctrl+Shift+[ 置底生效(元素不会消失)',
afterBottom !== before && afterBottom.endsWith(String(activeName)), afterBottom)
check('置底后原图不再被钉在最底 —— 图层可以压到原图下面(v1.13 解封)',
!afterBottom.endsWith('原图'), afterBottom)
await page.keyboard.press('Control+Shift+]') // 置顶
check('Ctrl+Shift+] 置顶生效', (await panelSeq()) !== afterBottom, await panelSeq())
check('排序后仍只有一个选中项', (await activeCount()) === 1, 'active=' + await activeCount())
// 复原成画笔工具,避免影响后面「覆盖」链路的画笔取样