增加加密群公告和群主转让

This commit is contained in:
xhgit committed 2026-11-15 17:20:18 +08:00
1 parent 52c0e52ffd
commit 47b76080c6
10 files changed
+163 -22

No files matched your search

+34
View File
@@ -210,6 +210,21 @@ test('Windows 与 Web 加密群聊支持消息操作、附件、语音和成员
await unreadGroup.waitFor({ state: 'detached', timeout: 4500 })
assert.equal(await windows.getByRole('link', { name: new RegExp(group + '.*未读') }).count(), 0)
const announcement = '群公告 ' + id()
const ownerAnnouncement = chat(owner).getByRole('region', { name: '群公告' })
await ownerAnnouncement.getByRole('button', { name: '写群公告' }).click()
await ownerAnnouncement.getByLabel('公告内容').fill(announcement)
const announcementPost = owner.waitForRequest((request) => /\/groups\/[^/]+\/messages$/.test(request.url()) && request.method() === 'POST')
await ownerAnnouncement.getByRole('button', { name: '发布公告' }).click()
assert.ok(!Buffer.from((await announcementPost).postDataJSON().wire, 'base64').includes(Buffer.from(announcement)))
const windowsAnnouncement = chat(windows).getByRole('region', { name: '群公告' })
await windowsAnnouncement.getByText(announcement, { exact: true }).waitFor()
assert.equal(await windowsAnnouncement.getByRole('button').count(), 0)
await ownerAnnouncement.getByRole('button', { name: '编辑群公告' }).click()
await ownerAnnouncement.getByLabel('公告内容').clear()
await ownerAnnouncement.getByRole('button', { name: '清除公告' }).click()
await windowsAnnouncement.waitFor({ state: 'detached' })
const original = chat(owner).getByRole('listitem').filter({ hasText: first })
assert.equal(await original.getByRole('button', { name: '编辑', exact: true }).count(), 0)
assert.equal(await original.getByRole('button', { name: '撤回', exact: true }).count(), 0)
@@ -524,6 +539,25 @@ test('Windows 与 Web 加密群聊支持消息操作、附件、语音和成员
await chat(owner).getByRole('button', { name: '下载 ' + privateFile, exact: true }).click()
assert.notDeepEqual(await (await groupFileResponse).body(), originalBytes)
assert.deepEqual(await readFile(await (await groupDownload).path()), contents)
await work(windows).getByRole('link', { name: '群组' }).click()
await windows.getByRole('link', { name: new RegExp(targetGroup) }).click()
const successor = owner.getByRole('list', { name: '群成员' }).getByRole('listitem').filter({ hasText: names[1] })
await successor.getByRole('button', { name: '转让群主', exact: true }).click()
await owner.getByRole('button', { name: '确认操作', exact: true }).click()
await windows.getByRole('list', { name: '群成员' }).getByText(names[1] + ' · 群主', { exact: true }).waitFor()
await owner.getByRole('button', { name: '退出群组', exact: true }).waitFor()
await owner.getByRole('button', { name: '退出群组', exact: true }).click()
await owner.getByRole('button', { name: '确认操作', exact: true }).click()
await owner.getByRole('heading', { name: targetGroup }).waitFor({ state: 'detached' })
await windows.getByRole('list', { name: '群成员' }).getByText(names[0] + ' · 成员', { exact: true }).waitFor({ state: 'detached' })
await chat(windows).getByRole('button', { name: '启用本机群聊' }).click()
await publish(windows, [windows])
const successorAnnouncement = chat(windows).getByRole('region', { name: '群公告' })
await successorAnnouncement.getByRole('button', { name: '写群公告' }).click()
await successorAnnouncement.getByLabel('公告内容').fill('新群主公告')
await successorAnnouncement.getByRole('button', { name: '发布公告' }).click()
await successorAnnouncement.getByText('新群主公告', { 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 })