交付双端账号安全、外观设置和加密草稿

This commit is contained in:
xhgit committed 2026-11-17 12:56:04 +08:00
1 parent 961fd68f49
commit 752ba88c5c
22 files changed
+896 -38

No files matched your search

+32
View File
@@ -215,6 +215,15 @@ test('Windows 与 Web 加密群聊支持消息操作、附件、语音和成员
await Promise.all([verify(windows, names[0], codes[0]), verify(removed, names[0], codes[0])])
await Promise.all([verify(windows, names[2], codes[2]), verify(removed, names[1], codes[1])])
await Promise.all(pages.map((page) => chat(page).getByText('群加密已建立', { exact: true }).waitFor()))
const draftText = '群聊未发送草稿 ' + id()
await chat(windows).getByRole('textbox', { name: '群消息', exact: true }).fill(draftText)
await chat(windows).getByText('草稿已保存在本机', { exact: true }).waitFor()
await work(windows).getByRole('link', { name: '联系人', exact: true }).click()
await work(windows).getByRole('link', { name: '群组', exact: true }).click()
await windows.getByRole('link', { name: new RegExp(group) }).click()
await chat(windows).getByRole('button', { name: '启用本机群聊' }).click()
await chat(windows).getByText('已恢复本机草稿', { exact: true }).waitFor()
assert.equal(await chat(windows).getByRole('textbox', { name: '群消息', exact: true }).inputValue(), draftText)
const first = 'Windows 群消息 ' + id()
await work(removed).getByRole('link', { name: '联系人' }).click()
holdConnection = true
@@ -627,8 +636,17 @@ test('Windows 与 Web 加密群聊支持消息操作、附件、语音和成员
await work(windows).getByRole('link', { name: '消息', exact: true }).click()
await windows.getByRole('link', { name: names[0] }).click()
await windows.waitForURL(/#\/chat\/[0-9a-f-]+$/)
await windows.route('**/contacts/*/devices', async (route) => {
const response = await route.fetch()
const devices = await response.json()
assert.ok(devices.some((device) => !device.mls))
devices.sort((a, b) => Number(Boolean(a.mls)) - Number(Boolean(b.mls)))
await route.fulfill({ response, json: devices })
})
await windows.getByRole('button', { name: '启用本机加密聊天' }).click()
await windows.getByText('设备已验证', { exact: true }).waitFor()
assert.notEqual(await windows.getByLabel('对方设备').inputValue(), await windows.locator('.chat-page select option').first().getAttribute('value'))
await windows.unroute('**/contacts/*/devices')
const privateFile = '私聊文件-' + id() + '.txt'
const privateAttachments = windows.getByRole('region', { name: '私聊附件发送区' })
await privateAttachments.locator('input:enabled').setInputFiles({ name: privateFile, mimeType: 'text/plain', buffer: contents })
@@ -741,10 +759,24 @@ test('Windows 与 Web 加密群聊支持消息操作、附件、语音和成员
await windows.getByLabel('来源', { exact: true }).selectOption('private')
await downloads.waitFor()
assert.equal(await downloads.count(), 1)
await work(windows).getByRole('link', { name: '设置', exact: true }).click()
await windows.getByLabel('消息发送方式', { exact: true }).selectOption('enter')
await windows.getByRole('button', { name: '保存设置' }).click()
await work(windows).getByRole('link', { name: '群组', exact: true }).click()
await windows.getByRole('link', { name: new RegExp(targetGroup) }).click()
await chat(windows).getByRole('button', { name: '启用本机群聊' }).click()
const keyboardText = '群聊 Enter 发送 ' + id()
const composer = chat(windows).getByRole('textbox', { name: '群消息', exact: true })
await composer.fill(keyboardText)
await composer.press('Shift+Enter')
assert.equal(await composer.inputValue(), keyboardText + '\n')
await composer.press('Enter')
await chat(windows).getByRole('list', { name: '群消息记录' }).getByText(keyboardText, { 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 })
} finally {
if (desktop) await desktop.evaluate(({ dialog }) => { dialog.showMessageBoxSync = () => 1 }).catch(() => {})
await desktop?.close()
await browser.close()
await rm(profile, { recursive: true, force: true })