接通双端加密语音录制与播放

This commit is contained in:
xhgit committed 2026-11-13 23:39:13 +08:00
1 parent 149028267e
commit 87676ae983
13 files changed
+217 -10

No files matched your search

+11 -1
View File
@@ -50,7 +50,7 @@ test('Web 与 Windows 安全码校验、加密互发、离线接收和状态恢
await web.goto(base)
desktop = await _electron.launch({
executablePath: electron,
args: [join(import.meta.dirname, '..', 'Desktop'), '--user-data-dir=' + profile],
args: [join(import.meta.dirname, '..', 'Desktop'), '--user-data-dir=' + profile, '--use-fake-device-for-media-stream'],
env: { ...process.env, XHCHAT_SERVER_URL: base },
})
const windows = await desktop.firstWindow()
@@ -185,6 +185,16 @@ test('Web 与 Windows 安全码校验、加密互发、离线接收和状态恢
assert.notDeepEqual(forwarded.postDataBuffer(), uploaded)
await windows.getByRole('button', { name: '下载 ' + fileName, exact: true }).nth(1).waitFor()
await windows.getByRole('button', { name: '录制语音', exact: true }).click()
await windows.getByRole('button', { name: '发送语音', exact: true }).waitFor()
await windows.getByText(/录音中 1 \/ 60 秒/).waitFor()
await windows.getByRole('button', { name: '发送语音', exact: true }).click()
await web.getByRole('button', { name: '播放语音', exact: true }).click()
await web.waitForFunction(() => {
const audio = document.querySelector('audio')
return audio && audio.readyState >= HTMLMediaElement.HAVE_CURRENT_DATA && audio.currentTime > 0
})
await windows.getByRole('button', { name: '退出登录' }).click()
await windows.getByRole('heading', { name: '登录 XHChat' }).waitFor()
const offline = '离线补拉 ' + randomBytes(8).toString('hex')