汇总私聊与群聊本机收藏
This commit is contained in:
1 parent
a7d85f183c
commit
e08c990cc7
12 files changed
+314
-24
No files matched your search
@@ -388,6 +388,48 @@ test('Web 与 Windows 安全码校验、加密互发、离线接收和状态恢
|
||||
const address = toolbar.getByRole('textbox', { name: '网址或搜索关键词' })
|
||||
await toolbar.waitForFunction((expected) => document.querySelector('#address')?.value === expected, link)
|
||||
assert.equal(await address.inputValue(), link)
|
||||
await toolbar.close()
|
||||
|
||||
async function addFavorite(page, locator) {
|
||||
const line = page.getByRole('list', { name: '消息记录' }).getByRole('listitem').filter({ has: locator })
|
||||
await line.getByRole('button', { name: '收藏', exact: true }).click()
|
||||
await line.getByRole('button', { name: '取消收藏', exact: true }).waitFor()
|
||||
}
|
||||
await addFavorite(web, webLink)
|
||||
await addFavorite(web, web.getByRole('button', { name: '下载 ' + remainingFile, exact: true }))
|
||||
await addFavorite(windows, windows.getByRole('button', { name: '预览 加密预览.png', exact: true }))
|
||||
await addFavorite(windows, windows.getByRole('button', { name: '播放语音', exact: true }))
|
||||
await Promise.all([web, windows].map((page) => work(page).getByRole('link', { name: '收藏', exact: true }).click()))
|
||||
const webFavorites = web.getByRole('list', { name: '本机收藏' })
|
||||
const windowsFavorites = windows.getByRole('list', { name: '本机收藏' })
|
||||
await webFavorites.getByRole('link', { name: link, exact: true }).waitFor()
|
||||
assert.equal(await webFavorites.getByRole('listitem').count(), 2)
|
||||
const tracked = []
|
||||
const trackFavorites = (request) => tracked.push([request.url(), request.method(), request.postData()])
|
||||
web.on('request', trackFavorites)
|
||||
await web.getByLabel('内容类型').selectOption('link')
|
||||
assert.equal(await webFavorites.getByRole('listitem').count(), 1)
|
||||
const search = web.getByRole('searchbox', { name: '搜索本机收藏' })
|
||||
const marker = '本机收藏验收 ' + randomBytes(8).toString('hex')
|
||||
await search.fill(marker)
|
||||
await web.getByText('没有匹配的收藏。', { exact: true }).waitFor()
|
||||
await search.clear()
|
||||
await web.getByLabel('内容类型').selectOption('file')
|
||||
const favoriteDownload = web.waitForEvent('download')
|
||||
await webFavorites.getByRole('button', { name: '下载 ' + remainingFile, exact: true }).click()
|
||||
assert.deepEqual(await readFile(await (await favoriteDownload).path()), Buffer.from(remainingFile))
|
||||
await webFavorites.getByRole('button', { name: '取消收藏', exact: true }).click()
|
||||
await web.getByText('没有匹配的收藏。', { exact: true }).waitFor()
|
||||
web.off('request', trackFavorites)
|
||||
assert.ok(tracked.every(([url, method, body]) => method === 'GET' && !body && !url.includes(encodeURIComponent(marker))))
|
||||
|
||||
await windows.getByLabel('内容类型').selectOption('image')
|
||||
await windowsFavorites.getByRole('button', { name: '预览 加密预览.png', exact: true }).click()
|
||||
await windowsFavorites.getByRole('img', { name: '加密预览.png' }).waitFor()
|
||||
await windows.getByLabel('内容类型').selectOption('voice')
|
||||
await windowsFavorites.getByRole('button', { name: '播放语音', exact: true }).click()
|
||||
await windows.waitForFunction(() => document.querySelector('.favorite-card audio')?.currentTime > 0)
|
||||
assert.equal(await windowsFavorites.getByRole('link', { name: link, exact: true }).count(), 0)
|
||||
} finally {
|
||||
await desktop?.close()
|
||||
await browser.close()
|
||||
|
||||
Reference in new issue
Block a user