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

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
@@ -261,6 +261,10 @@ test('Web 与 Windows 安全码校验、加密互发、离线接收和状态恢
await windows.getByRole('button', { name: '关闭预览' }).click()
assert.equal(await image.count(), 0)
const privateDraft = '重新登录恢复的私聊草稿 ' + randomBytes(8).toString('hex')
await windows.getByRole('textbox', { name: '消息', exact: true }).fill(privateDraft)
await windows.getByText('草稿已保存在本机', { exact: true }).waitFor()
assert.ok(!(await windows.evaluate(() => JSON.stringify(localStorage))).includes(privateDraft))
await windows.getByRole('button', { name: '退出登录' }).click()
await windows.getByRole('heading', { name: '登录 XHChat' }).waitFor()
const offline = '离线补拉 ' + randomBytes(8).toString('hex')
@@ -268,6 +272,9 @@ test('Web 与 Windows 安全码校验、加密互发、离线接收和状态恢
await login(windows, b, password, false)
await windows.evaluate((url) => { location.hash = new URL(url).hash }, windowsChat)
assert.equal(await enable(windows), desktopCode)
await windows.getByText('已恢复本机草稿', { exact: true }).waitFor()
assert.equal(await windows.getByRole('textbox', { name: '消息', exact: true }).inputValue(), privateDraft)
await windows.getByRole('textbox', { name: '消息', exact: true }).clear()
await windows.getByText(offline, { exact: true }).waitFor()
const stored = await windows.evaluate(async () => {
const db = await new Promise((resolve, reject) => {
@@ -466,7 +473,32 @@ test('Web 与 Windows 安全码校验、加密互发、离线接收和状态恢
await enable(windows)
await windows.getByRole('button', { name: '预览 加密预览.png', exact: true }).waitFor()
await windows.getByRole('button', { name: '播放语音', exact: true }).waitFor()
await work(windows).getByRole('link', { name: '设置', exact: true }).click()
await windows.getByLabel('消息发送方式', { exact: true }).selectOption('ctrl-enter')
await windows.getByRole('button', { name: '保存设置' }).click()
await windows.getByText('已保存本机设置').waitFor()
await windows.evaluate((url) => { location.hash = new URL(url).hash }, windowsChat)
await enable(windows)
const composer = windows.getByRole('textbox', { name: '消息', exact: true })
const shortcutText = '快捷键验收 ' + randomBytes(8).toString('hex')
await composer.fill(shortcutText)
await composer.press('Enter')
assert.equal(await composer.inputValue(), shortcutText + '\n')
await composer.dispatchEvent('keydown', { key: 'Enter', ctrlKey: true, isComposing: true, bubbles: true, cancelable: true })
assert.equal(await windows.getByRole('list', { name: '消息记录' }).getByText(shortcutText, { exact: true }).count(), 0)
await composer.press('Control+Enter')
await web.getByRole('list', { name: '消息记录' }).getByText(shortcutText, { exact: true }).waitFor()
await work(windows).getByRole('link', { name: '联系人' }).click()
await windows.evaluate((url) => { location.hash = new URL(url).hash }, windowsChat)
await enable(windows)
await composer.fill('编辑时保留的草稿')
await windows.getByText('草稿已保存在本机', { exact: true }).waitFor()
await windows.getByRole('listitem').filter({ hasText: shortcutText }).getByRole('button', { name: '编辑', exact: true }).click()
await composer.fill('临时编辑内容')
await windows.getByRole('button', { name: '取消编辑' }).click()
assert.equal(await composer.inputValue(), '编辑时保留的草稿')
} finally {
if (desktop) await desktop.evaluate(({ dialog }) => { dialog.showMessageBoxSync = () => 1 }).catch(() => {})
await desktop?.close()
await browser.close()
await rm(profile, { recursive: true, maxRetries: 5, retryDelay: 200, force: true })