增加私聊置顶和按设备统计未读

This commit is contained in:
xhgit committed 2026-11-15 22:35:45 +08:00
1 parent 7e165ba9b4
commit ec2679b991
19 files changed
+312 -52

No files matched your search

+18
View File
@@ -99,6 +99,11 @@ test('Web 与 Windows 安全码校验、加密互发、离线接收和状态恢
assert.equal(await web.getByRole('button', { name: '发送', exact: true }).count(), 0)
await trust(web, desktopCode)
await trust(windows, webCode)
const pin = web.getByRole('button', { name: '会话置顶', exact: true })
await pin.click()
await conversation.getByText('已置顶', { exact: true }).waitFor()
assert.equal(await pin.getAttribute('aria-pressed'), 'true')
assert.equal(await windows.getByRole('button', { name: '会话置顶' }).getAttribute('aria-pressed'), 'false')
const text = 'Web 到 Windows ' + randomBytes(8).toString('hex')
const packets = []
@@ -297,6 +302,12 @@ test('Web 与 Windows 安全码校验、加密互发、离线接收和状态恢
await web.waitForURL(webChat)
await enable(web)
await web.getByText(webNoticeText, { exact: true }).waitFor()
await conversation.getByText('已置顶', { exact: true }).waitFor()
await pin.click()
await conversation.getByText('已置顶', { exact: true }).waitFor({ state: 'detached' })
await conversation.locator('.unread-badge').waitFor()
await web.evaluate(() => { document.hasFocus = () => true; window.dispatchEvent(new Event('focus')) })
await conversation.locator('.unread-badge').waitFor({ state: 'detached' })
await muteToggle(web).click()
await web.getByRole('button', { name: '消息免打扰', pressed: true }).waitFor()
@@ -306,9 +317,16 @@ test('Web 与 Windows 安全码校验、加密互发、离线接收和状态恢
await web.getByRole('button', { name: '消息免打扰', pressed: true }).waitFor()
const mutedText = '免打扰仍能同步 ' + randomBytes(8).toString('hex')
await send(windows, mutedText)
await work(web).getByRole('link', { name: '消息', exact: true }).click()
const badge = conversation.getByRole('link', { name: new RegExp(b) }).locator('.unread-badge.muted')
await badge.waitFor()
assert.equal(await badge.locator('.unread-label').textContent(), '1 条未读')
await work(web).getByRole('link', { name: '联系人' }).click()
await web.getByRole('button', { name: new RegExp(b) }).click()
await web.getByRole('link', { name: '打开加密聊天' }).click()
await enable(web)
await web.getByText(mutedText, { exact: true }).waitFor()
await badge.waitFor({ state: 'detached' })
assert.equal(await privateNotice(web).count(), 0)
assert.equal(await web.evaluate(() => window.privateNotificationLog.length), 1)