支持加密图片与视频的本机预览

This commit is contained in:
xhgit committed 2026-11-13 23:41:56 +08:00
1 parent 87676ae983
commit 6b728a0996
10 files changed
+94 -7

No files matched your search

+10
View File
@@ -195,6 +195,16 @@ test('Web 与 Windows 安全码校验、加密互发、离线接收和状态恢
return audio && audio.readyState >= HTMLMediaElement.HAVE_CURRENT_DATA && audio.currentTime > 0
})
const pixel = Buffer.from('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+jf2sAAAAASUVORK5CYII=', 'base64')
await web.locator('input[type=file]').setInputFiles({ name: '加密预览.png', mimeType: 'image/png', buffer: pixel })
await windows.getByRole('button', { name: '预览 加密预览.png' }).click()
const image = windows.getByRole('img', { name: '加密预览.png' })
await image.waitFor()
await windows.waitForFunction(() => document.querySelector('img[alt="加密预览.png"]')?.naturalWidth === 1)
assert.match(await image.getAttribute('src'), /^blob:/)
await windows.getByRole('button', { name: '关闭预览' }).click()
assert.equal(await image.count(), 0)
await windows.getByRole('button', { name: '退出登录' }).click()
await windows.getByRole('heading', { name: '登录 XHChat' }).waitFor()
const offline = '离线补拉 ' + randomBytes(8).toString('hex')