test(image-annotate): 真站 e2e 断言撤销组在工具条最右

This commit is contained in:
qiqi committed 2026-11-10 07:01:02 +08:00
1 parent a94e5be954
commit 929b7ec2a1
1 file changed
+18 -4
+18 -4
View File
@@ -183,10 +183,24 @@ if (!SKIP_PASTE) {
(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))
// v1.18(用户 2026-11-10):撤销 / 重做 / 还原 从顶栏搬到工具条最右,
// 「适应窗口 / 收起侧栏」退到它前面两位。这里断言「末尾是撤销组、视图按钮在其前」
// —— 光看版本号挡不住产物没重建。
const toolsOrder = await page.evaluate(() => {
const kids = Array.from(document.querySelectorAll('.iwb-editor-tools > *'))
const acts = kids.filter((n) => n.dataset && n.dataset.action).map((n) => n.dataset.action)
const hist = kids[kids.length - 1]
return {
tail: acts.slice(-2),
lastIsHistory: Boolean(hist && hist.classList.contains('iwb-editor-history')),
histActs: [...(hist ? hist.querySelectorAll('[data-action]') : [])].map((b) => b.dataset.action),
headerHasHistory: Boolean(document.querySelector('.iwb-editor-header .iwb-editor-history')),
}
})
check('工具栏最右是「撤销/重做/还原」组(视图按钮在其前)',
JSON.stringify(toolsOrder.tail) === JSON.stringify(['zoomFit', 'togglePanels']) &&
toolsOrder.lastIsHistory && toolsOrder.histActs.join(',') === 'undo,redo,reset' &&
!toolsOrder.headerHasHistory, JSON.stringify(toolsOrder))
const before = await panelSeq()
const activeName = await page.evaluate(() => document.querySelector('.iwb-editor-layer-list .iwb-layer-item.active .iwb-layer-name')?.textContent)