Files
menchuang/frontend/scripts/verify-menu.mjs
T
HHY e3b4056855 fix: v2.6 组合画布选中根因修复+右键菜单+3D 三场景
- 选中失效根因: Vue3 布尔 prop 缺省转换(editable 缺省→false)
  withDefaults 默认 true 修复, 左键选中/右键选中/菜单动作全链路打通
- 右键菜单: 右键单元弹操作菜单(顺/逆旋转/镜像/底边对齐/删除)
  动作 emit('ctx') 由父组件统一执行, document 级委托
- 3D 三场景: 室内(窗后墙+木地板)/室外(外墙+草地)/影棚(网格)
  场景联动背景色, 真实浏览器截图验证三场景渲染
- 菜单动作行为级验证: 旋转后 1600x1800 宽高互换✓ 删除清空✓
2026-09-22 05:11:47 -07:00

42 lines
2.0 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 菜单动作行为级验证: node scripts/verify-menu.mjs <token>
import puppeteer from 'puppeteer-core'
const EDGE = 'C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe'
const token = process.argv[2]
const browser = await puppeteer.launch({
executablePath: EDGE,
headless: 'new',
args: ['--window-size=1440,900', '--enable-unsafe-swiftshader', '--use-gl=angle', '--use-angle=swiftshader'],
defaultViewport: { width: 1440, height: 900 },
})
const page = await browser.newPage()
await page.goto(`http://localhost:8000/combine?token=${encodeURIComponent(token)}`, { waitUntil: 'networkidle2' })
await page.waitForSelector('.lib-item')
await page.click('.lib-item')
await new Promise(r => setTimeout(r, 600))
const box = await (await page.$('.canvas-box')).boundingBox()
const cx = box.x + box.width / 2, cy = box.y + box.height / 2
// ① 右键 → 菜单 → 真实鼠标点击"顺时针旋转90°"
await page.mouse.click(cx, cy, { button: 'right' })
await new Promise(r => setTimeout(r, 300))
const item0 = await page.$$('.ctx-item')
const r0 = item0.length ? await item0[0].boundingBox() : null
if (r0) await page.mouse.click(r0.x + r0.width / 2, r0.y + r0.height / 2)
await new Promise(r => setTimeout(r, 400))
const hint1 = await page.$eval('.hud span', el => el.textContent)
console.log('① 旋转后 hint:', hint1, '(原始 1800×1600 → 期望 1600×1800)')
// ② 右键 → 真实鼠标点击"删除单元"
await page.mouse.click(cx, cy, { button: 'right' })
await new Promise(r => setTimeout(r, 300))
const itemN = await page.$$('.ctx-item')
const rN = itemN.length ? await itemN[itemN.length - 1].boundingBox() : null
if (rN) await page.mouse.click(rN.x + rN.width / 2, rN.y + rN.height / 2)
await new Promise(r => setTimeout(r, 400))
const hint2 = await page.$eval('.hud span', el => el.textContent)
console.log('② 删除后 hint:', hint2, '(期望"拖入样板开始组合")')
await page.screenshot({ path: 'D:/Code/huamenchuang/shots/v4-menu-actions.png' })
await browser.close()
console.log('验证完成')