增加群消息跨会话加密转发
This commit is contained in:
1 parent
2e51827a07
commit
c36e94fd1c
9 files changed
+212
-13
No files matched your search
@@ -321,6 +321,58 @@ test('Windows 与 Web 加密群聊支持消息操作、附件、语音和成员
|
||||
await chat(windows).getByRole('checkbox', { name: '只看收藏' }).check()
|
||||
await history.getByRole('button', { name: '取消收藏', exact: true }).waitFor()
|
||||
assert.equal(await chat(windows).getByRole('listitem').count(), 1)
|
||||
await chat(windows).getByRole('searchbox', { name: '搜索本机群消息' }).clear()
|
||||
await chat(windows).getByRole('checkbox', { name: '只看收藏' }).uncheck()
|
||||
|
||||
const targetGroup = '转发目标 ' + id()
|
||||
await owner.getByLabel('群名称', { exact: true }).fill(targetGroup)
|
||||
await owner.getByRole('button', { name: '创建群组' }).click()
|
||||
await owner.getByRole('heading', { name: targetGroup }).waitFor()
|
||||
await owner.getByLabel('邀请联系人').selectOption({ label: names[1] })
|
||||
await owner.getByRole('button', { name: '发送邀请' }).click()
|
||||
await windows.getByRole('link', { name: new RegExp(targetGroup) }).click()
|
||||
await windows.getByRole('button', { name: '接受邀请' }).click()
|
||||
await owner.getByRole('list', { name: '群成员' }).getByRole('listitem').getByText(names[1] + ' · 成员', { exact: true }).waitFor()
|
||||
await windows.getByRole('link', { name: new RegExp(group) }).click()
|
||||
await chat(windows).getByRole('button', { name: '启用本机群聊' }).click()
|
||||
const forwardPanel = chat(windows).getByRole('form', { name: '转发群消息' })
|
||||
const forwardFile = chat(windows).getByRole('listitem').filter({ hasText: filename }).getByRole('button', { name: '转发', exact: true })
|
||||
await forwardFile.click()
|
||||
await forwardPanel.getByLabel('转发给').selectOption({ label: targetGroup })
|
||||
await forwardPanel.getByRole('button', { name: '确认转发' }).click()
|
||||
await chat(windows).getByRole('alert').getByText('请先在目标群加入加密会话').waitFor()
|
||||
await forwardPanel.getByRole('button', { name: '取消', exact: true }).click()
|
||||
await windows.getByRole('link', { name: new RegExp(targetGroup) }).click()
|
||||
await chat(windows).getByRole('button', { name: '启用本机群聊' }).click()
|
||||
await chat(owner).getByRole('button', { name: '启用本机群聊' }).click()
|
||||
await publish(owner, [owner, windows])
|
||||
await windows.getByRole('link', { name: new RegExp(group) }).click()
|
||||
await chat(windows).getByRole('button', { name: '启用本机群聊' }).click()
|
||||
|
||||
const forwarded = windows.waitForResponse((item) => /\/groups\/[^/]+\/attachments\/[^/]+\?epoch=/.test(item.url()) &&
|
||||
item.request().method() === 'POST')
|
||||
await forwardFile.click()
|
||||
await forwardPanel.getByLabel('转发给').selectOption({ label: targetGroup })
|
||||
await forwardPanel.getByRole('button', { name: '确认转发' }).click()
|
||||
const newBlob = await forwarded
|
||||
assert.equal(newBlob.status(), 204)
|
||||
assert.notEqual(new URL(newBlob.url()).pathname.split('/').at(-1), new URL(response.url()).pathname.split('/').at(-1))
|
||||
await chat(windows).getByText('已转发到群聊', { exact: true }).waitFor()
|
||||
const newResponse = owner.waitForResponse((item) => item.url().endsWith(new URL(newBlob.url()).pathname) && item.request().method() === 'GET')
|
||||
const newDownload = owner.waitForEvent('download')
|
||||
await chat(owner).getByRole('button', { name: '下载 ' + filename }).click()
|
||||
assert.notDeepEqual(await (await newResponse).body(), ciphertext)
|
||||
assert.deepEqual(await readFile(await (await newDownload).path()), contents)
|
||||
|
||||
await chat(windows).getByRole('listitem').filter({ hasText: edited }).getByRole('button', { name: '转发', exact: true }).click()
|
||||
await forwardPanel.getByLabel('转发给').selectOption({ label: names[0] })
|
||||
await forwardPanel.getByLabel('目标设备').waitFor()
|
||||
await forwardPanel.getByRole('button', { name: '确认转发' }).click()
|
||||
await chat(windows).getByText('已提交转发', { exact: true }).waitFor()
|
||||
await work(owner).getByRole('link', { name: '消息', exact: true }).click()
|
||||
await owner.getByRole('link', { name: names[1] }).click()
|
||||
await owner.getByRole('button', { name: '启用本机加密聊天' }).click()
|
||||
await owner.getByText(edited, { exact: true }).waitFor()
|
||||
} catch (error) {
|
||||
const status = await Promise.all(pages.map((page) => page.locator('[role=alert], .group-chat [role=status]').allTextContents()))
|
||||
throw new Error(JSON.stringify(status), { cause: error })
|
||||
|
||||
Reference in new issue
Block a user