增加一次性群邀请链接和二维码
This commit is contained in:
1 parent
dfeb5bfefa
commit
5ec9c81f90
18 files changed
+727
-14
No files matched your search
@@ -482,11 +482,35 @@ test('Windows 与 Web 加密群聊支持消息操作、附件、语音和成员
|
||||
await owner.getByRole('button', { name: '创建群组' }).click()
|
||||
await owner.getByRole('heading', { name: targetGroup }).waitFor()
|
||||
assert.match(await owner.getByRole('complementary', { name: '群组列表' }).getByRole('link').first().textContent(), /已置顶/)
|
||||
await owner.getByLabel('邀请联系人').selectOption({ label: names[1] })
|
||||
await owner.getByRole('button', { name: '发送邀请' }).click()
|
||||
await windows.getByRole('link', { name: new RegExp(targetGroup) }).click()
|
||||
await owner.getByText('群邀请链接和二维码', { exact: true }).click()
|
||||
await owner.getByRole('button', { name: '生成邀请链接', exact: true }).click()
|
||||
const qr = owner.getByRole('img', { name: '群邀请二维码' })
|
||||
const inviteURL = await owner.getByLabel('邀请链接', { exact: true }).inputValue()
|
||||
assert.match(inviteURL, /#\/groups\?invite=[A-Za-z0-9_-]{43}$/)
|
||||
await owner.waitForFunction(() => {
|
||||
const image = document.querySelector('canvas[aria-label="群邀请二维码"]')
|
||||
return image?.getContext('2d').getImageData(0, 0, 1, 1).data[3] === 255
|
||||
})
|
||||
assert.ok(await qr.evaluate((canvas) => canvas.width > 150))
|
||||
await windows.getByLabel('群邀请链接或邀请码').fill(inviteURL)
|
||||
await windows.getByRole('button', { name: '领取群邀请' }).click()
|
||||
await windows.getByRole('heading', { name: targetGroup }).waitFor()
|
||||
await windows.getByRole('button', { name: '接受邀请' }).click()
|
||||
await owner.getByRole('list', { name: '群成员' }).getByRole('listitem').getByText(names[1] + ' · 成员', { exact: true }).waitFor()
|
||||
|
||||
await owner.getByRole('button', { name: '重新生成邀请链接', exact: true }).click()
|
||||
await owner.waitForFunction((old) => document.querySelector('.invite-output input')?.value !== old, inviteURL)
|
||||
const newURL = await owner.getByLabel('邀请链接', { exact: true }).inputValue()
|
||||
const invitePage = await browser.newPage()
|
||||
await invitePage.goto(newURL)
|
||||
await invitePage.getByRole('heading', { name: '登录 XHChat' }).waitFor()
|
||||
assert.ok(!new URL(invitePage.url()).hash.includes('invite='))
|
||||
await register(invitePage, 'inviteqa_' + id(), password)
|
||||
await invitePage.getByRole('button', { name: '领取群邀请' }).click()
|
||||
await invitePage.getByRole('heading', { name: targetGroup }).waitFor()
|
||||
await invitePage.getByRole('button', { name: '拒绝邀请' }).click()
|
||||
await invitePage.getByRole('heading', { name: targetGroup }).waitFor({ state: 'detached' })
|
||||
await invitePage.close()
|
||||
await windows.getByRole('link', { name: new RegExp(group) }).click()
|
||||
await chat(windows).getByRole('button', { name: '启用本机群聊' }).click()
|
||||
const forwardPanel = chat(windows).getByRole('form', { name: '转发群消息' })
|
||||
@@ -586,7 +610,11 @@ test('Windows 与 Web 加密群聊支持消息操作、附件、语音和成员
|
||||
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.getByText(new RegExp('确认将群主转让给 ' + names[1])).waitFor()
|
||||
const transferred = owner.waitForResponse((response) => response.request().method() === 'POST' &&
|
||||
/\/groups\/[^/]+$/.test(response.url()) && response.request().postDataJSON().action === 'transfer')
|
||||
await owner.getByRole('button', { name: '确认操作', exact: true }).click()
|
||||
assert.equal((await transferred).status(), 204)
|
||||
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()
|
||||
|
||||
Reference in new issue
Block a user