test: 冒烟新增逐席对话截图(--each),验证十席各切独立会话

This commit is contained in:
qyh15 2026-11-15 00:41:12 +08:00
parent f917dd3970
commit e01ac88d56
14 changed files with 55 additions and 1 deletions

View File

@ -103,6 +103,22 @@ async function main() {
await shot('live-05-report.png')
}
if (process.argv.includes('--each')) {
result.each = []
const n = await evaluate("document.querySelectorAll('.ssw-seat').length")
for (let i = 0; i < n; i++) {
await evaluate(`(() => { const s = document.querySelectorAll('.ssw-seat'); if (s[${i}]) s[${i}].click(); return true })()`)
await sleep(1200)
const info = await evaluate(`(() => ({
name: document.querySelector('.ssw-current-name')?.innerText?.trim() ?? null,
notice: document.querySelector('.ssw-notice')?.innerText?.trim() ?? null,
selected: document.querySelector('.ssw-seat[aria-pressed=true] .ssw-role-name')?.innerText?.trim() ?? null,
}))()`)
await shot('seat-' + String(i + 1).padStart(2, '0') + '.png')
result.each.push({ i: i + 1, ...info })
}
}
if (process.argv.includes('--seat')) {
const clicked = await evaluate("(() => { const s = document.querySelectorAll('.ssw-seat'); if (s.length >= 10) { s[9].click(); return true } return false })()")
await sleep(1500)
@ -130,7 +146,8 @@ async function main() {
}
}
result.pass = !!(result.entry?.found && result.workbench?.found && (result.workbench?.seatCount === 10 || result.workbench?.enableText)
&& (!process.argv.includes('--report') || (result.report?.count === 10 && result.report.items.every(it => it.name && it.text))))
&& (!process.argv.includes('--report') || (result.report?.count === 10 && result.report.items.every(it => it.name && it.text)))
&& (!process.argv.includes('--each') || result.each?.length === 10))
}
try { await main() } catch (error) { result.fatal = String(error?.stack ?? error) } finally { try { ws?.close() } catch {}; try { browser?.kill() } catch {} }

27
preview/montage.py Normal file
View File

@ -0,0 +1,27 @@
from PIL import Image, ImageDraw, ImageFont
seats = [("丞相","e35483b1"),("中书","4e278758"),("尚书","2e65d691"),("门下","78223c4a"),("吏部","cf800860"),
("户部","82262be8"),("礼部","1f2aeec7"),("兵部","2ce3587b"),("刑部","57f94de8"),("工部","857831f9")]
crop = (772, 0, 1440, 900)
tw, th = 300, 397
cols, rows, pad, labelh = 5, 2, 10, 24
tiles = []
for i in range(1, 11):
im = Image.open(f"preview/seat-{i:02d}.png").convert("RGB").crop(crop).resize((tw, th))
tiles.append(im)
W = cols * tw + (cols + 1) * pad
H = rows * (th + labelh) + (rows + 1) * pad
canvas = Image.new("RGB", (W, H), "white")
d = ImageDraw.Draw(canvas)
try:
font = ImageFont.truetype("C:/Windows/Fonts/msyh.ttc", 15)
except Exception:
font = ImageFont.load_default()
for idx, (name, sid) in enumerate(seats):
r, c = idx // cols, idx % cols
x = pad + c * (tw + pad)
y = pad + r * (th + labelh + pad)
canvas.paste(tiles[idx], (x, y))
d.rectangle([x, y + th, x + tw, y + th + labelh], fill="#eef4ff")
d.text((x + 6, y + th + 4), f"{name} {sid}", fill="#1f2a3a", font=font)
canvas.save("preview/seats-contact.png")
print("saved", canvas.size)

BIN
preview/seat-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
preview/seat-02.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
preview/seat-03.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
preview/seat-04.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
preview/seat-05.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
preview/seat-06.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
preview/seat-07.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
preview/seat-08.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
preview/seat-09.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
preview/seat-10.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

BIN
preview/seats-contact.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

10
preview/seats-summary.mjs Normal file
View File

@ -0,0 +1,10 @@
import fs from 'node:fs'
const r = JSON.parse(fs.readFileSync('preview/each.json', 'utf8'))
const st = JSON.parse(fs.readFileSync('C:/Users/qyh15/.dsh-test-b/sansheng/state.json', 'utf8'))
const proj = Object.values(st.projects)[0]
const seats = proj ? Object.values(proj.seats) : []
console.log(JSON.stringify({
pass: r.pass,
each: r.each,
seats: seats.map(s => ({ seat: s.seatId, session: (s.sessionId || '').slice(0, 8), status: s.status })),
}, null, 2))