增加会话导航与可选加密已读回执

This commit is contained in:
xhgit committed 2026-11-13 23:35:26 +08:00
1 parent 6786158a3e
commit 149028267e
8 files changed
+218 -17

No files matched your search

+20 -1
View File
@@ -70,7 +70,14 @@ test('Web 与 Windows 安全码校验、加密互发、离线接收和状态恢
await web.getByRole('button', { name: '添加好友' }).click()
await windows.getByRole('button', { name: new RegExp(a) }).click()
await windows.getByRole('button', { name: '接受申请' }).click()
await web.getByRole('link', { name: '打开加密聊天' }).click()
await web.getByRole('link', { name: '打开加密聊天' }).waitFor()
await work(web).getByRole('link', { name: '消息', exact: true }).click()
const conversation = web.getByRole('complementary', { name: '会话列表' })
await conversation.getByRole('link', { name: b }).waitFor()
await web.getByLabel('查找会话').fill('没有匹配')
await web.getByText('没有匹配的会话。').waitFor()
await web.getByLabel('查找会话').clear()
await conversation.getByRole('link', { name: b }).click()
await windows.getByRole('link', { name: '打开加密聊天' }).click()
const windowsChat = windows.url()
let webCode, desktopCode
@@ -102,6 +109,18 @@ test('Web 与 Windows 安全码校验、加密互发、离线接收和状态恢
assert.ok(!Buffer.from(packet.ciphertext, 'base64').includes(Buffer.from(text)))
assert.deepEqual(Object.keys(packet).sort(), ['ciphertext', 'messageId', 'recipientDevice'])
await windows.getByText(text, { exact: true }).waitFor()
const sentLine = web.getByRole('listitem').filter({ hasText: text })
assert.equal(await sentLine.getByText('已读', { exact: true }).count(), 0)
assert.equal(await windows.getByLabel('发送已读回执').isChecked(), false)
const receiptPackets = []
windows.on('request', (req) => {
if (req.method() === 'POST' && req.url().endsWith('/api/v1/inbox')) receiptPackets.push(req.postDataJSON())
})
await desktop.evaluate(({ BrowserWindow }) => BrowserWindow.getAllWindows()[0].focus())
await windows.getByLabel('发送已读回执').check()
await sentLine.getByText('已读', { exact: true }).waitFor({ timeout: 15_000 })
assert.ok(receiptPackets.length > 0)
assert.ok(receiptPackets.every((item) => !JSON.stringify(item).includes(packet.messageId)))
const reply = 'Windows 到 Web ' + randomBytes(8).toString('hex')
await windows.getByRole('listitem').filter({ hasText: text }).getByRole('button', { name: '引用', exact: true }).click()
await send(windows, reply)