test: 支持打开指定席会话截图(礼部)

This commit is contained in:
qyh15 2026-11-15 01:02:26 +08:00
parent f82913260f
commit 8e62f5ec8b
2 changed files with 21 additions and 0 deletions

View File

@ -109,6 +109,27 @@ async function main() {
} catch {}
}
const oi = process.argv.indexOf('--open')
if (oi >= 0) {
const seatId = process.argv[oi + 1]
const order = { lead: 0, zhongshu: 1, shangshu: 2, menxia: 3, libu: 4, hubu: 5, lipu: 6, bingbu: 7, xingbu: 8, gongbu: 9 }
const idx = order[seatId]
if (idx !== undefined) {
const clicked = await evaluate(`(() => { const s = document.querySelectorAll('.ssw-seat'); if (s[${idx}]) { s[${idx}].click(); return true } return false })()`)
const noticeEarly = await evaluate("document.querySelector('.ssw-notice')?.innerText?.trim() ?? null")
await sleep(1800)
result.open = await evaluate(`(() => ({
mainText: (document.querySelector('main')?.innerText || '').replace(/\\s+/g, ' ').trim().slice(0, 320),
composer: (document.querySelector('.composer')?.innerText || '').replace(/\\s+/g, ' ').trim().slice(0, 120),
title: document.title,
}))()`)
result.open.seatId = seatId
result.open.clicked = clicked
result.open.noticeEarly = noticeEarly
await shot('live-07-' + seatId + '-session.png')
}
}
if (process.argv.includes('--each')) {
result.each = []
const n = await evaluate("document.querySelectorAll('.ssw-seat').length")

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB