workspace.spec.ts 62 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070
  1. import { expect, test } from '@playwright/test'
  2. const WIDE_DOCX_BASE64 = 'UEsDBAoAAAAIAKwmFF15bjPX6AAAAK0BAAATAAAAW0NvbnRlbnRfVHlwZXNdLnhtbH1QyU7DMBD9FWuuKHHggBCK0wPLETiUDxjZk8SqN3nc0v49Tlt6QIXjzFv1+tXeO7GjzDYGBbdtB4KCjsaGScHn+rV5AMEFg0EXAyk4EMNq6NeHRCyqNrCCuZT0KCXrmTxyGxOFiowxeyz1zJNMqDc4kbzrunupYygUSlMWDxj6Zxpx64p42df3qUcmxyCeTsQlSwGm5KzGUnG5C+ZXSnNOaKvyyOHZJr6pBJBXExbk74Cz7r0Ok60h8YG5vKGvLPkVs5Em6q2vyvZ/mys94zhaTRf94pZy1MRcF/euvSAebfjpL49zD99QSwMECgAAAAAArCYUXQAAAAAAAAAAAAAAAAYAAABfcmVscy9QSwMECgAAAAgArCYUXZv9N+qtAAAAKQEAAAsAAABfcmVscy8ucmVsc43POw7CMAwG4KtE3mlaBoRQ0y4IqSsqB7ASN61oHkrCo7cnAwNFDIy2f3+W6/ZpZnanECdnBVRFCYysdGqyWsClP232wGJCq3B2lgQsFKFt6jPNmPJKHCcfWTZsFDCm5A+cRzmSwVg4TzZPBhcMplwGzT3KK2ri27Lc8fBpwNpknRIQOlUB6xdP/9huGCZJRydvhmz6ceIrkWUMmpKAhwuKq3e7yCzwpuarF5sXUEsDBAoAAAAAAKwmFF0AAAAAAAAAAAAAAAAFAAAAd29yZC9QSwMECgAAAAgArCYUXalT+9hjAQAABwMAABEAAAB3b3JkL2RvY3VtZW50LnhtbKVSW0/CMBT+K03fpXMBJYRBFAaaYDSKwdeydluTrW3awsBfb7uVDYwmJr6cc75z+c6lHU8PZQH2VGkmeASvewEElCeCMJ5F8H29uBpCoA3mBBeC0wgeqYbTybgaEZHsSsoNsARcj6oI5sbIEUI6yWmJdU9Iym0sFarExkKVoUooIpVIqNaWvyxQGAQ3qMSMQ0e5FeTotHRCOWEmG0YomD/PPoBUdM9oNUbO7aSqZZ1stoVXL8obG1C5oa6DYWB3sq6jtOOTA4bIZ6zwUexMG0rZgRIXRJdES8WIMzOrZ6JoaAd9y4p+daOLStNQJY30xMnmrOT7fKhLPD/GKl6swfrufhWDeL6MfzgF6vr8u9vr4/Lhb+1QsyNqH0LTxHjC7O3Tv0QY9uveubUHw76/n8yesHITCRnB27DOUCzLTYu2whhRtrCgaRfLKSZURbAGqRCmBdnOeNBseBoJnf4Z6v7w5AtQSwECFAAKAAAACACsJhRdeW4z1+gAAACtAQAAEwAAAAAAAAAAAAAAAAAAAAAAW0NvbnRlbnRfVHlwZXNdLnhtbFBLAQIUAAoAAAAAAKwmFF0AAAAAAAAAAAAAAAAGAAAAAAAAAAAAEAAAABkBAABfcmVscy9QSwECFAAKAAAACACsJhRdm/036q0AAAApAQAACwAAAAAAAAAAAAAAAAA9AQAAX3JlbHMvLnJlbHNQSwECFAAKAAAAAACsJhRdAAAAAAAAAAAAAAAABQAAAAAAAAAAABAAAAATAgAAd29yZC9QSwECFAAKAAAACACsJhRdqVP72GMBAAAHAwAAEQAAAAAAAAAAAAAAAAA2AgAAd29yZC9kb2N1bWVudC54bWxQSwUGAAAAAAUABQAgAQAAyAMAAAAA'
  3. const E2E_PASSWORD = 'e2e-password'
  4. test.beforeAll(async ({ request }) => {
  5. const signIn = async (password: string) => {
  6. const initial = await request.get('/api/app/bootstrap')
  7. const initialBody = await initial.json() as { csrfToken: string }
  8. return request.post('/api/app/login', {
  9. headers: { Origin: 'http://127.0.0.1:18801', 'X-CSRF-Token': initialBody.csrfToken },
  10. data: { username: 'admin', password },
  11. })
  12. }
  13. let login = await signIn(E2E_PASSWORD)
  14. if (!login.ok()) login = await signIn('admin')
  15. expect(login.ok()).toBe(true)
  16. const loginBody = await login.json() as { csrfToken: string; user: { mustChangePassword?: boolean } }
  17. if (loginBody.user.mustChangePassword) {
  18. const changed = await request.put('/api/app/account/credentials', {
  19. headers: { Origin: 'http://127.0.0.1:18801', 'X-CSRF-Token': loginBody.csrfToken },
  20. data: { currentPassword: 'admin', newPassword: E2E_PASSWORD, username: 'admin' },
  21. })
  22. expect(changed.ok()).toBe(true)
  23. }
  24. })
  25. test.beforeEach(async ({ page }) => {
  26. await page.goto('/chat')
  27. if (await page.getByRole('heading', { name: '登录夭夭' }).isVisible()) {
  28. await page.getByLabel('账号').fill('admin')
  29. await page.getByLabel('密码').fill(E2E_PASSWORD)
  30. await page.getByRole('button', { name: '登录' }).click()
  31. }
  32. await expect(page.getByRole('navigation')).toBeVisible()
  33. })
  34. test('separates writable Web chats from read-only Hermes history', async ({ page }) => {
  35. const sidebar = page.locator('.desktop-sidebar')
  36. await expect(page.getByRole('button', { name: '新建聊天', exact: true })).toBeVisible()
  37. await expect(sidebar.getByText('Hermes 外部历史', { exact: true })).toHaveCount(0)
  38. await sidebar.getByRole('button', { name: '历史记录', exact: true }).click()
  39. await expect(page).toHaveURL(/\/history/)
  40. await expect(page.getByText('选择历史记录', { exact: true })).toBeVisible()
  41. await expect(sidebar.getByText('Hermes 外部历史', { exact: true })).toBeVisible()
  42. await expect(sidebar.getByText('夭夭 Web 验收会话', { exact: true })).toHaveCount(0)
  43. await sidebar.getByText('Hermes 外部历史', { exact: true }).click()
  44. await expect(page).toHaveURL(/\/history\/session-history-only/)
  45. await expect(page.locator('.composer-shell')).toHaveCount(0)
  46. await sidebar.getByRole('button', { name: '聊天', exact: true }).click()
  47. await expect(page).toHaveURL(/\/chat/)
  48. await expect(page.getByRole('button', { name: '新建聊天', exact: true })).toBeVisible()
  49. })
  50. test('explains optional upstream credentials without blocking a ready connection', async ({ page }, testInfo) => {
  51. await page.getByRole('button', { name: /^(打开设置中心|设置与模式)$/ }).first().click()
  52. if (await page.getByRole('menuitem', { name: '进入设置', exact: true }).isVisible()) await page.getByRole('menuitem', { name: '进入设置', exact: true }).click()
  53. const dialog = page.getByRole('dialog', { name: '设置中心' })
  54. await dialog.getByRole('button', { name: 'Hermes 连接', exact: true }).click()
  55. await expect(dialog.locator('[aria-label="Hermes 连接状态"]')).toBeVisible()
  56. await expect(dialog.getByText('9119 连接正常', { exact: true })).toBeVisible()
  57. await expect(dialog.getByRole('heading', { name: '服务账号(按需配置)' })).toBeVisible()
  58. await expect(dialog.getByText(/无需配置用户名和密码/)).toBeVisible()
  59. await expect(dialog.locator('input[name="upstream-username"]')).toHaveValue('')
  60. await expect(dialog.locator('input[name="upstream-password"]')).toHaveValue('')
  61. await page.screenshot({ path: testInfo.outputPath('loopback-authorization.png') })
  62. })
  63. test('uses the yaoyao-webui grouped model picker without a mobile full-screen sheet', async ({ page }) => {
  64. await page.goto('/chat/session-demo')
  65. await page.locator('.composer-tool--model').click()
  66. const dialog = page.getByRole('dialog', { name: '选择模型' })
  67. await expect(dialog).toBeVisible()
  68. await expect(dialog.getByPlaceholder('搜索模型名称或 ID')).toBeFocused()
  69. await expect(dialog.locator('.model-dialog__group-header')).toContainText('OpenAI')
  70. await expect(dialog.locator('.model-dialog__item--active')).toContainText('gpt-5.6')
  71. const desktopBox = await dialog.boundingBox()
  72. expect(desktopBox?.width).toBeGreaterThanOrEqual(450)
  73. expect(desktopBox?.width).toBeLessThanOrEqual(480)
  74. await dialog.getByPlaceholder('搜索模型名称或 ID').fill('gpt-5.5')
  75. await expect(dialog.locator('.model-dialog__item')).toHaveCount(1)
  76. await page.keyboard.press('Escape')
  77. await expect(dialog).toBeHidden()
  78. await page.setViewportSize({ width: 390, height: 844 })
  79. await page.locator('.composer-tool--model').click()
  80. const mobileBox = await dialog.boundingBox()
  81. expect(mobileBox?.x).toBeGreaterThanOrEqual(12)
  82. expect(mobileBox?.width).toBeLessThanOrEqual(366)
  83. expect(mobileBox?.height).toBeLessThan(820)
  84. })
  85. test('navigates every 9119 workspace without blank transitions', async ({ page }) => {
  86. const consoleErrors: string[] = []
  87. page.on('console', message => { if (message.type() === 'error') consoleErrors.push(message.text()) })
  88. await expect(page.getByRole('option').first()).toContainText('夭夭 Web 验收会话')
  89. await expect(page.getByRole('option').first()).toContainText('夭夭')
  90. await expect(page.locator('.desktop-sidebar').getByText('已置顶 1', { exact: true })).toBeVisible()
  91. await page.getByRole('button', { name: '团队' }).click()
  92. await expect(page.getByRole('heading', { name: '设计验收' })).toBeVisible()
  93. await expect(page.getByRole('button', { name: '对话', exact: true })).toBeVisible()
  94. await expect(page.getByRole('button', { name: '团队', exact: true })).toHaveCount(0)
  95. await expect(page.getByRole('button', { name: '文件库', exact: true })).toHaveCount(0)
  96. await expect(page.getByRole('button', { name: '产物', exact: true })).toHaveCount(0)
  97. await expect(page.getByRole('button', { name: '新建团队' })).toBeVisible()
  98. await page.mouse.move(1200, 20)
  99. await expect(page.getByRole('button', { name: '新建团队' })).toHaveCSS('background-color', 'rgba(0, 0, 0, 0)')
  100. await expect(page.getByRole('button', { name: '新建团队' })).toHaveCSS('font-weight', '650')
  101. await expect(page.getByRole('button', { name: '管理团队', exact: true })).toBeVisible()
  102. await expect(page.getByRole('button', { name: '发送消息' })).toBeVisible()
  103. await page.goto('/files')
  104. await expect(page.getByRole('heading', { name: '文件库', exact: true }).last()).toBeVisible()
  105. const fileSidebar = page.locator('.desktop-sidebar')
  106. await expect(fileSidebar.getByRole('button', { name: '新建聊天' })).toBeVisible()
  107. await expect(fileSidebar.getByRole('button', { name: '搜索', exact: true })).toHaveCount(0)
  108. const compactControlHeights = await fileSidebar.locator('.sidebar-search-trigger, .sidebar-primary-action button, .sidebar-feature-nav button').evaluateAll(elements => (
  109. elements.map(element => element.getBoundingClientRect().height)
  110. ))
  111. expect(compactControlHeights.length).toBeGreaterThanOrEqual(3)
  112. expect(Math.max(...compactControlHeights)).toBeLessThanOrEqual(36)
  113. await expect(page.getByText('demo-report.pdf')).toBeVisible()
  114. const firstFileCard = page.locator('.library-grid article').first()
  115. const cardGeometry = await firstFileCard.evaluate(element => {
  116. const card = element.getBoundingClientRect()
  117. const preview = element.querySelector('.library-thumb')?.getBoundingClientRect()
  118. return { width: card.width, previewHeight: preview?.height || 0 }
  119. })
  120. expect(cardGeometry.width).toBeGreaterThanOrEqual(220)
  121. expect(cardGeometry.previewHeight).toBe(154)
  122. await page.getByText('demo-report.pdf').click()
  123. await expect(page.getByRole('dialog', { name: /预览 demo-report.pdf/ })).toBeVisible()
  124. await expect(page.locator('.preview-meta')).toHaveCount(0)
  125. const previewDialog = page.getByRole('dialog', { name: /预览 demo-report.pdf/ })
  126. await expect(previewDialog.getByRole('link', { name: '下载' })).toBeVisible()
  127. await expect(previewDialog.getByRole('button', { name: '加入输入框' })).toBeVisible()
  128. await expect(previewDialog.locator('.preview-close')).toBeVisible()
  129. const modalHeight = await page.locator('.preview-modal').evaluate(element => element.getBoundingClientRect().height)
  130. expect(modalHeight).toBeGreaterThan(600)
  131. await previewDialog.locator('.preview-close').click()
  132. await fileSidebar.getByRole('button', { name: '新建聊天' }).click()
  133. await expect(page).toHaveURL(/\/chat\/draft-[^?]+\?profile=yaoyao/)
  134. await page.goto('/artifacts')
  135. await expect(page).toHaveURL(/\/chat$/)
  136. await expect(page.getByRole('button', { name: '产物', exact: true })).toHaveCount(0)
  137. expect(consoleErrors).toEqual([])
  138. })
  139. test('uses the active session or group title in the browser title', async ({ page }) => {
  140. await page.goto('/chat/session-demo?profile=yaoyao')
  141. await expect(page).toHaveTitle('夭夭 Web 验收会话 · 夭夭')
  142. await page.goto('/groups/group-demo')
  143. await expect(page).toHaveTitle('设计与工程协作 · 夭夭')
  144. })
  145. test('uses split search for topics, teams, and archived content', async ({ page }) => {
  146. await page.getByRole('button', { name: '团队' }).click()
  147. await expect(page.getByRole('heading', { name: '设计验收' })).toBeVisible()
  148. await page.locator('.desktop-sidebar').getByRole('button', { name: '搜索', exact: true }).click()
  149. const searchDialog = page.getByRole('dialog', { name: '搜索话题、团队或归档' })
  150. await expect(searchDialog).toBeVisible()
  151. await expect(searchDialog.getByRole('navigation', { name: '搜索范围' })).toContainText('设计与工程协作')
  152. await searchDialog.getByRole('searchbox', { name: '搜索全部' }).fill('发布检查')
  153. const topicResult = searchDialog.getByRole('option', { name: /发布检查/ })
  154. await expect(topicResult).toBeVisible()
  155. await topicResult.click()
  156. await expect(page).toHaveURL(/\/groups\/22222222-2222-4222-8222-222222222222\/88888888-8888-4888-8888-888888888888$/)
  157. await expect(searchDialog).toBeHidden()
  158. })
  159. test('shows member mascot clusters in the list and during creation', async ({ page }) => {
  160. await page.getByRole('button', { name: '团队' }).click()
  161. const topicRow = page.locator('[data-sidebar-id="topic:22222222-2222-4222-8222-222222222222:77777777-7777-4777-8777-777777777777"]')
  162. const roomAvatar = topicRow.getByRole('img', { name: '设计验收团队头像' })
  163. await expect(roomAvatar).toBeVisible()
  164. await expect(roomAvatar.locator('.team-avatar__member')).toHaveCount(3)
  165. const releaseTopicAvatar = page.locator('[data-sidebar-id="topic:22222222-2222-4222-8222-222222222222:88888888-8888-4888-8888-888888888888"]').first().locator('.team-avatar__member')
  166. await expect(releaseTopicAvatar).toHaveCount(3)
  167. await page.getByRole('button', { name: '新建团队' }).click()
  168. const dialog = page.getByRole('dialog', { name: '新建团队' })
  169. await expect(dialog.getByRole('region', { name: '团队预设' })).toBeVisible()
  170. await expect(dialog.getByRole('button', { name: /信息收集团队/ })).toBeDisabled()
  171. await expect(dialog.getByRole('button', { name: /信息收集团队/ })).toContainText('还缺 2 人')
  172. await expect(dialog.getByText('由成员的动态角色自动组成')).toBeVisible()
  173. await expect(dialog.getByRole('button', { name: '成员组合' })).toBeVisible()
  174. await expect(dialog.locator('.team-avatar__member')).toHaveCount(3)
  175. await expect(dialog.getByRole('button', { name: '上传图片' })).toBeVisible()
  176. await dialog.locator('input[type="file"]').setInputFiles('public/brand/AppIcon-1024.png')
  177. await expect(dialog.getByText('使用上传的图片')).toBeVisible()
  178. await expect(dialog.getByRole('img', { name: '团队团队头像' }).locator('img')).toBeVisible()
  179. })
  180. test('updates an existing team avatar from the Web manager', async ({ page }) => {
  181. await page.getByRole('button', { name: '团队' }).click()
  182. await page.getByRole('button', { name: '管理团队', exact: true }).click()
  183. const manager = page.locator('.group-manager')
  184. const preview = manager.getByRole('img', { name: '设计与工程协作团队头像' })
  185. await expect(preview.locator('.team-avatar__member')).toHaveCount(3)
  186. const uploadRequest = page.waitForRequest(request => request.method() === 'PATCH' && request.url().endsWith('/rooms/22222222-2222-4222-8222-222222222222'))
  187. await manager.locator('input[type="file"]').setInputFiles('public/brand/AppIcon-1024.png')
  188. expect((await uploadRequest).postDataJSON().avatar).toMatch(/^data:image\/png;base64,/)
  189. await expect(manager.getByText('使用上传的图片')).toBeVisible()
  190. await expect(preview.locator('img')).toBeVisible()
  191. const dynamicRequest = page.waitForRequest(request => request.method() === 'PATCH' && request.url().endsWith('/rooms/22222222-2222-4222-8222-222222222222'))
  192. await manager.getByRole('button', { name: '成员组合' }).click()
  193. expect((await dynamicRequest).postDataJSON()).toMatchObject({ avatar: '' })
  194. await expect(manager.getByText('由成员的动态角色自动组成')).toBeVisible()
  195. await expect(preview.locator('.team-avatar__member')).toHaveCount(3)
  196. })
  197. test('selects one protocol v5 host independently from no-mention replies', async ({ page }) => {
  198. await page.getByRole('button', { name: '团队' }).click()
  199. await expect(page.locator('.group-host-chip')).toHaveText('管理员 夭夭')
  200. await page.getByRole('button', { name: '新建团队' }).click()
  201. const createDialog = page.getByRole('dialog', { name: '新建团队' })
  202. await createDialog.getByRole('button', { name: /yaoer/ }).click()
  203. await createDialog.getByLabel('管理员').selectOption({ label: '瑶儿' })
  204. await expect(createDialog.getByLabel('所有成员无需 @ 也回复')).toBeChecked()
  205. await createDialog.getByRole('button', { name: '关闭' }).click()
  206. await page.getByRole('button', { name: '管理团队', exact: true }).click()
  207. const manager = page.locator('.group-manager')
  208. await expect(manager.getByLabel('管理员')).toHaveValue('33333333-3333-4333-8333-333333333333')
  209. const promoteRequest = page.waitForRequest(request => request.method() === 'PATCH' && request.url().endsWith('/agents/34343434-3434-4434-8434-343434343434'))
  210. await manager.getByLabel('管理员').selectOption({ label: '瑶儿' })
  211. expect((await promoteRequest).postDataJSON()).toMatchObject({ isHost: true })
  212. await expect(manager.locator('article').filter({ hasText: '瑶儿' }).getByText('管理员', { exact: true })).toBeVisible()
  213. await expect(page.locator('.group-host-chip')).toHaveText('管理员 瑶儿')
  214. const restoreRequest = page.waitForRequest(request => request.method() === 'PATCH' && request.url().endsWith('/agents/33333333-3333-4333-8333-333333333333'))
  215. await manager.getByLabel('管理员').selectOption({ label: '夭夭' })
  216. expect((await restoreRequest).postDataJSON()).toMatchObject({ isHost: true })
  217. await expect(page.locator('.group-host-chip')).toHaveText('管理员 夭夭')
  218. })
  219. test('edits every protocol v5 Agent setting with one inspector close control', async ({ page }) => {
  220. await page.getByRole('button', { name: '团队' }).click()
  221. await expect(page.getByRole('heading', { name: '设计验收' })).toBeVisible()
  222. await page.getByRole('button', { name: '管理团队', exact: true }).click()
  223. await expect(page.getByRole('button', { name: '关闭团队管理' })).toHaveCount(1)
  224. await expect(page.getByRole('button', { name: '关闭预览' })).toHaveCount(0)
  225. await expect(page.getByLabel('最多回复轮数')).toHaveValue('-1')
  226. await page.getByRole('button', { name: '设置瑶儿' }).click()
  227. const editor = page.getByRole('dialog', { name: '瑶儿 Agent 设置' })
  228. await expect(page.locator('.group-manager .agent-editor')).toHaveCount(0)
  229. await expect(editor.getByLabel('群内名称')).toHaveValue('瑶儿')
  230. await expect(editor.getByLabel('职责说明')).toHaveValue('评审 Agent')
  231. await expect(editor.getByLabel('模型')).toHaveValue(JSON.stringify(['openai', 'gpt-5.6']))
  232. await expect(editor.getByLabel('推理强度')).toHaveValue('medium')
  233. await expect(editor.getByLabel('快速模式')).toHaveValue('false')
  234. await editor.getByLabel('群内名称').fill('所有人')
  235. const rejectedResponse = page.waitForResponse(response => response.request().method() === 'PATCH' && /\/api\/app\/groups\/rooms\/[^/]+\/agents\/[^/]+$/.test(new URL(response.url()).pathname))
  236. await editor.getByRole('button', { name: '保存 Agent 设置' }).click()
  237. expect((await rejectedResponse).status()).toBe(409)
  238. await expect(editor.getByRole('alert')).toContainText('成员名称不能使用“所有人”')
  239. await editor.getByRole('button', { name: '关闭 Agent 设置' }).click()
  240. await page.getByRole('button', { name: '设置瑶儿' }).click()
  241. await expect(editor.getByLabel('群内名称')).toHaveValue('所有人')
  242. await editor.getByLabel('群内名称').fill('瑶儿')
  243. await editor.getByLabel('模型').selectOption(JSON.stringify(['openai', 'gpt-5.5']))
  244. await editor.getByLabel('推理强度').selectOption('xhigh')
  245. await editor.getByLabel('快速模式').selectOption('true')
  246. await editor.getByLabel('无需 @ 也回复').check()
  247. const updateRequest = page.waitForRequest(request => request.method() === 'PATCH' && /\/api\/app\/groups\/rooms\/[^/]+\/agents\/[^/]+$/.test(new URL(request.url()).pathname))
  248. await editor.getByRole('button', { name: '保存 Agent 设置' }).click()
  249. expect((await updateRequest).postDataJSON()).toMatchObject({
  250. model: 'gpt-5.5', provider: 'openai', reasoningEffort: 'xhigh', fastMode: true, replyWithoutMention: true,
  251. })
  252. await expect(editor.getByLabel('模型')).toHaveValue(JSON.stringify(['openai', 'gpt-5.5']))
  253. await editor.getByLabel('模型').selectOption(JSON.stringify(['openai', 'gpt-5.6']))
  254. await editor.getByLabel('推理强度').selectOption('medium')
  255. await editor.getByLabel('快速模式').selectOption('false')
  256. await editor.getByLabel('无需 @ 也回复').uncheck()
  257. const restoreResponse = page.waitForResponse(response => response.request().method() === 'PATCH' && /\/api\/app\/groups\/rooms\/[^/]+\/agents\/[^/]+$/.test(new URL(response.url()).pathname))
  258. await editor.getByRole('button', { name: '保存 Agent 设置' }).click()
  259. expect((await restoreResponse).status()).toBe(200)
  260. })
  261. test('pins the named Agent typing status above the group composer', async ({ page }) => {
  262. await page.getByRole('button', { name: '团队' }).click()
  263. const composer = page.locator('.composer-area')
  264. await page.getByRole('textbox', { name: '发消息给团队,输入 @ 提及 Agent' }).fill('@夭夭 检查输入状态')
  265. await page.getByRole('button', { name: '发送消息' }).click()
  266. const typing = composer.getByRole('status', { name: 'Agent 输入状态' })
  267. await page.waitForTimeout(250)
  268. await expect(typing).toHaveCount(0)
  269. await expect(typing).toHaveText('夭夭正在输入…')
  270. await expect(page.locator('.message-stack .thinking-indicator')).toHaveCount(0)
  271. const typingBox = await typing.boundingBox()
  272. const shellBox = await composer.locator('.composer-shell').boundingBox()
  273. expect(typingBox?.y).toBeLessThan(shellBox?.y ?? 0)
  274. await expect(typing).toHaveCount(0, { timeout: 4_000 })
  275. })
  276. test('reconnects the group event stream after an unexpected close', async ({ page }) => {
  277. await page.getByRole('button', { name: '团队' }).click()
  278. await expect(page.getByText('已同步', { exact: true })).toBeVisible()
  279. const before = await (await page.request.get('http://127.0.0.1:19119/__test/group-connections')).json() as { count: number }
  280. await page.request.post('http://127.0.0.1:19119/__test/groups/disconnect')
  281. await expect.poll(async () => {
  282. const value = await (await page.request.get('http://127.0.0.1:19119/__test/group-connections')).json() as { count: number }
  283. return value.count
  284. }, { timeout: 5_000 }).toBeGreaterThan(before.count)
  285. await expect(page.getByText('已同步', { exact: true })).toBeVisible()
  286. })
  287. test('recovers the group page after its initial upstream connection fails', async ({ page }) => {
  288. await page.request.post('http://127.0.0.1:19119/__test/groups/availability', { data: { available: false } })
  289. await page.getByRole('button', { name: '团队' }).click()
  290. await expect(page.getByRole('heading', { name: '团队服务暂不可用' })).toBeVisible()
  291. await page.request.post('http://127.0.0.1:19119/__test/groups/availability', { data: { available: true } })
  292. await expect(page.getByRole('heading', { name: '设计验收' })).toBeVisible({ timeout: 5_000 })
  293. })
  294. test('previews an octet-stream Markdown file from the file library', async ({ page }) => {
  295. await page.route('**/api/app/files**', async route => {
  296. const url = new URL(route.request().url())
  297. if (url.pathname === '/api/app/files') {
  298. await route.fulfill({
  299. status: 200,
  300. contentType: 'application/json',
  301. body: JSON.stringify({
  302. profile: 'yaoyao',
  303. items: [{
  304. id: 'markdown-file',
  305. path: '/tmp/版本说明.md',
  306. name: '版本说明.md',
  307. extension: '.md',
  308. mimeType: 'application/octet-stream',
  309. size: 48,
  310. modifiedAt: Date.now() / 1000,
  311. exists: true,
  312. origins: [{ profile: 'yaoyao', sessionId: 'session-demo', sessionTitle: '夭夭 Web 验收会话' }],
  313. }, {
  314. id: 'empty-markdown-file',
  315. path: '/tmp/空白说明.md',
  316. name: '空白说明.md',
  317. extension: 'md',
  318. mimeType: 'application/octet-stream',
  319. size: 0,
  320. modifiedAt: Date.now() / 1000,
  321. exists: true,
  322. origins: [{ profile: 'yaoyao', sessionId: 'session-demo', sessionTitle: '夭夭 Web 验收会话' }],
  323. }],
  324. nextCursor: null,
  325. total: 2,
  326. }),
  327. })
  328. return
  329. }
  330. if (url.pathname === '/api/app/files/markdown-file/preview') {
  331. await route.fulfill({
  332. status: 200,
  333. contentType: 'application/octet-stream',
  334. body: '# 版本说明\n\n- Markdown 预览已恢复',
  335. })
  336. return
  337. }
  338. if (url.pathname === '/api/app/files/empty-markdown-file/preview') {
  339. await route.fulfill({ status: 200, contentType: 'application/octet-stream', body: '' })
  340. return
  341. }
  342. await route.continue()
  343. })
  344. await page.goto('/files')
  345. await page.getByText('版本说明.md', { exact: true }).click()
  346. const dialog = page.getByRole('dialog', { name: '预览 版本说明.md' })
  347. await expect(dialog.locator('.preview-text h1')).toHaveText('版本说明')
  348. await expect(dialog.getByText('Markdown 预览已恢复', { exact: true })).toBeVisible()
  349. await dialog.locator('.preview-close').click()
  350. await page.getByText('空白说明.md', { exact: true }).click()
  351. const emptyDialog = page.getByRole('dialog', { name: '预览 空白说明.md' })
  352. await expect(emptyDialog.locator('.preview-text')).toBeVisible()
  353. await expect(emptyDialog.locator('.preview-unavailable')).toHaveCount(0)
  354. })
  355. test('keeps DOCX body at 36px inset with zero canvas margin', async ({ page }) => {
  356. await page.setViewportSize({ width: 620, height: 760 })
  357. await page.route('**/api/app/files**', async route => {
  358. const url = new URL(route.request().url())
  359. if (url.pathname === '/api/app/files') {
  360. await route.fulfill({
  361. status: 200,
  362. contentType: 'application/json',
  363. body: JSON.stringify({
  364. profile: 'yaoyao',
  365. items: [{
  366. id: 'wide-docx-file',
  367. path: '/tmp/宽版文档.docx',
  368. name: '宽版文档.docx',
  369. extension: 'docx',
  370. mimeType: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
  371. size: 1024,
  372. modifiedAt: Date.now() / 1000,
  373. exists: true,
  374. origins: [{ profile: 'yaoyao', sessionId: 'session-demo', sessionTitle: '夭夭 Web 验收会话' }],
  375. }],
  376. nextCursor: null,
  377. total: 1,
  378. }),
  379. })
  380. return
  381. }
  382. if (url.pathname === '/api/app/files/wide-docx-file/preview') {
  383. await route.fulfill({
  384. status: 200,
  385. contentType: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
  386. body: Buffer.from(WIDE_DOCX_BASE64, 'base64'),
  387. })
  388. return
  389. }
  390. await route.continue()
  391. })
  392. await page.goto('/files')
  393. await page.getByText('宽版文档.docx', { exact: true }).click()
  394. const dialog = page.getByRole('dialog', { name: '预览 宽版文档.docx' })
  395. const office = dialog.locator('.preview-office')
  396. await expect(office.locator('section.docx')).toBeVisible()
  397. const geometry = await office.evaluate(element => {
  398. const wrapper = element.querySelector<HTMLElement>('.docx-wrapper')!
  399. const pageElement = element.querySelector<HTMLElement>('section.docx')!
  400. const article = pageElement.querySelector<HTMLElement>('article')!
  401. const table = article.querySelector<HTMLElement>('table')!
  402. const officeRect = element.getBoundingClientRect()
  403. const pageRect = pageElement.getBoundingClientRect()
  404. const officeStyle = getComputedStyle(element)
  405. const wrapperStyle = getComputedStyle(wrapper)
  406. const articleStyle = getComputedStyle(article)
  407. return {
  408. officeLeft: officeRect.left,
  409. pageLeft: pageRect.left,
  410. pageWidth: pageRect.width,
  411. clientWidth: element.clientWidth,
  412. scrollWidth: element.scrollWidth,
  413. wrapperWidth: wrapper.getBoundingClientRect().width,
  414. articlePaddingTop: Number.parseFloat(articleStyle.paddingTop),
  415. articlePaddingLeft: Number.parseFloat(articleStyle.paddingLeft),
  416. articlePaddingRight: Number.parseFloat(articleStyle.paddingRight),
  417. tableLeft: table.getBoundingClientRect().left,
  418. tableRight: table.getBoundingClientRect().right,
  419. officeBackground: officeStyle.backgroundColor,
  420. wrapperBackground: wrapperStyle.backgroundColor,
  421. wrapperPaddingTop: Number.parseFloat(wrapperStyle.paddingTop),
  422. wrapperPaddingLeft: Number.parseFloat(wrapperStyle.paddingLeft),
  423. wrapperPaddingRight: Number.parseFloat(wrapperStyle.paddingRight),
  424. }
  425. })
  426. expect(geometry.pageWidth).toBeLessThanOrEqual(geometry.clientWidth)
  427. expect(geometry.pageLeft).toBeGreaterThanOrEqual(geometry.officeLeft)
  428. expect(geometry.scrollWidth).toBeLessThanOrEqual(geometry.clientWidth + 1)
  429. expect(Math.abs(geometry.wrapperWidth - geometry.clientWidth)).toBeLessThan(1)
  430. expect(geometry.articlePaddingTop).toBe(36)
  431. expect(geometry.articlePaddingLeft).toBe(36)
  432. expect(geometry.articlePaddingRight).toBe(36)
  433. expect(geometry.tableLeft).toBeGreaterThanOrEqual(geometry.pageLeft - 1)
  434. expect(geometry.tableRight).toBeLessThanOrEqual(geometry.pageLeft + geometry.pageWidth + 1)
  435. expect(geometry.officeBackground).toBe('rgb(255, 255, 255)')
  436. expect(geometry.wrapperBackground).toBe('rgb(255, 255, 255)')
  437. expect(geometry.wrapperPaddingTop).toBe(0)
  438. expect(geometry.wrapperPaddingLeft).toBe(0)
  439. expect(geometry.wrapperPaddingRight).toBe(0)
  440. await page.setViewportSize({ width: 930, height: 760 })
  441. const centered = await office.evaluate(element => {
  442. const pageElement = element.querySelector<HTMLElement>('section.docx')!
  443. const officeRect = element.getBoundingClientRect()
  444. const pageRect = pageElement.getBoundingClientRect()
  445. return {
  446. pageWidth: pageRect.width,
  447. clientWidth: element.clientWidth,
  448. leftGap: pageRect.left - officeRect.left,
  449. rightGap: officeRect.right - pageRect.right,
  450. }
  451. })
  452. expect(centered.pageWidth).toBeLessThan(centered.clientWidth)
  453. expect(centered.leftGap).toBeGreaterThanOrEqual(18)
  454. expect(centered.rightGap).toBeGreaterThanOrEqual(18)
  455. expect(Math.abs(centered.leftGap - centered.rightGap)).toBeLessThanOrEqual(12)
  456. })
  457. test('keeps pins first and loads the next session page at the list bottom', async ({ page }) => {
  458. const sidebar = page.locator('.desktop-sidebar')
  459. const items = sidebar.locator('.sidebar-list [role="option"]')
  460. await expect(items).toHaveCount(100)
  461. await expect(items.first()).toContainText('夭夭 Web 验收会话')
  462. await expect(sidebar.getByRole('button', { name: '继续加载会话' })).toBeVisible()
  463. const list = sidebar.locator('.sidebar-list')
  464. await list.evaluate(element => {
  465. element.scrollTop = element.scrollHeight
  466. element.dispatchEvent(new Event('scroll'))
  467. })
  468. await expect(items).toHaveCount(103)
  469. await expect(sidebar.getByRole('button', { name: '继续加载会话' })).toHaveCount(0)
  470. })
  471. test('switches the composer model to the selected historical session model', async ({ page }) => {
  472. await page.goto('/chat/session-demo?profile=yaoyao')
  473. await expect(page.locator('.composer-tool--model')).toContainText('gpt-5.6')
  474. await page.getByRole('option', { name: /第二个会话/ }).click()
  475. await expect(page.locator('.composer-tool--model')).toContainText('gpt-5.5')
  476. })
  477. test('restores a routed conversation even when unread-count refresh fails', async ({ page }) => {
  478. await page.route('**/api/app/sessions/unread*', async route => {
  479. await route.fulfill({ status: 503, contentType: 'application/json', body: JSON.stringify({ error: 'unread unavailable' }) })
  480. })
  481. await page.goto('/chat/session-demo')
  482. await expect(page.getByText('已整理完成。下面是', { exact: false })).toBeVisible()
  483. await page.reload()
  484. await expect(page.getByText('已整理完成。下面是', { exact: false })).toBeVisible()
  485. })
  486. test('opens a conversation even when marking it read is unsupported', async ({ page }) => {
  487. const pageErrors: string[] = []
  488. page.on('pageerror', error => pageErrors.push(error.message))
  489. await page.route('**/api/app/sessions/unread/*', async route => {
  490. await route.fulfill({ status: 405, contentType: 'application/json', body: JSON.stringify({ error: 'Method Not Allowed' }) })
  491. })
  492. await page.getByRole('option').filter({ hasText: '第二个会话' }).click()
  493. await expect(page).toHaveURL(/\/chat\/session-second\?profile=yaoyao/)
  494. await expect(page.getByText('已整理完成。下面是', { exact: false })).toBeVisible()
  495. expect(pageErrors).toEqual([])
  496. })
  497. test('syncs the blue fast-mode shortcut with the iOS-compatible session config', async ({ page }) => {
  498. await page.request.post('http://127.0.0.1:19119/__test/rpc-requests/reset')
  499. await page.goto('/chat/session-demo')
  500. const fast = page.getByRole('button', { name: '快速模式:已关闭' })
  501. await expect(fast).toHaveAttribute('aria-pressed', 'false')
  502. await fast.click()
  503. const enabled = page.getByRole('button', { name: '快速模式:已开启' })
  504. await expect(enabled).toHaveAttribute('aria-pressed', 'true')
  505. await expect(enabled).toHaveCSS('color', 'rgb(22, 119, 255)')
  506. await page.getByRole('textbox', { name: '输入消息,Enter 发送,Shift + Enter 换行' }).fill('使用快速模式')
  507. await page.getByRole('button', { name: '发送消息' }).click()
  508. await expect(page.getByText('这是来自假 Gateway 的流式回复。', { exact: true })).toBeVisible()
  509. const payload = await (await page.request.get('http://127.0.0.1:19119/__test/rpc-requests')).json() as { requests: Array<{ method: string; params: Record<string, unknown> }> }
  510. const fastConfigIndex = payload.requests.findIndex(request => request.method === 'config.set' && request.params.key === 'fast')
  511. const promptIndex = payload.requests.findIndex(request => request.method === 'prompt.submit')
  512. expect(fastConfigIndex).toBeGreaterThanOrEqual(0)
  513. expect(promptIndex).toBeGreaterThan(fastConfigIndex)
  514. expect(payload.requests[fastConfigIndex]?.params).toMatchObject({ key: 'fast', value: 'fast', scope: 'session' })
  515. await enabled.click()
  516. await expect(page.getByRole('button', { name: '快速模式:已关闭' })).toHaveAttribute('aria-pressed', 'false')
  517. await expect.poll(async () => {
  518. const next = await (await page.request.get('http://127.0.0.1:19119/__test/rpc-requests')).json() as typeof payload
  519. return next.requests.filter(request => request.method === 'config.set' && request.params.key === 'fast').at(-1)?.params.value
  520. }).toBe('normal')
  521. })
  522. test('reconciles an iOS fast-mode selection from the resumed 9119 session', async ({ page }) => {
  523. await page.request.post('http://127.0.0.1:19119/__test/rpc-requests/reset')
  524. await page.goto('/chat/session-yaoer?profile=yaoer')
  525. await expect(page.getByRole('button', { name: '快速模式:已关闭' })).toBeVisible()
  526. await page.getByRole('textbox', { name: '输入消息,Enter 发送,Shift + Enter 换行' }).fill('读取 iOS 快速模式')
  527. await page.getByRole('button', { name: '发送消息' }).click()
  528. await expect(page.getByRole('button', { name: '快速模式:已开启' })).toHaveCSS('color', 'rgb(22, 119, 255)')
  529. const payload = await (await page.request.get('http://127.0.0.1:19119/__test/rpc-requests')).json() as { requests: Array<{ method: string; params: Record<string, unknown> }> }
  530. expect(payload.requests.some(request => request.method === 'session.resume' && request.params.session_id === 'session-yaoer')).toBe(true)
  531. expect(payload.requests.some(request => request.method === 'config.set' && request.params.key === 'fast')).toBe(false)
  532. })
  533. test('keeps the show-thinking preference across sessions of the same Agent', async ({ page }) => {
  534. await page.goto('/chat/session-demo')
  535. await expect(page.locator('.turn-trace')).toHaveCount(1)
  536. await page.locator('.composer-tool[aria-label="设置"]').click()
  537. const setting = page.getByRole('switch', { name: /显示思考/ })
  538. await expect(setting).toHaveAttribute('aria-checked', 'true')
  539. await setting.click()
  540. await expect(page.locator('.turn-trace')).toHaveCount(0)
  541. await page.getByRole('option').filter({ hasText: '第二个会话' }).click()
  542. await expect(page.locator('.turn-trace')).toHaveCount(0)
  543. await page.locator('.composer-tool[aria-label="设置"]').click()
  544. await page.getByRole('switch', { name: /显示思考/ }).click()
  545. await expect(page.locator('.turn-trace')).toHaveCount(1)
  546. })
  547. test('restores a legacy session link under its owning Agent profile', async ({ page }) => {
  548. await page.goto('/chat/session-yaoer')
  549. await expect(page.getByText('瑶儿历史消息', { exact: true })).toBeVisible()
  550. await expect(page).toHaveURL(/\/chat\/session-yaoer\?profile=yaoer/)
  551. await page.reload()
  552. await expect(page.getByText('瑶儿历史消息', { exact: true })).toBeVisible()
  553. })
  554. test('renders historical assistant MEDIA as Markdown in chat and group chat', async ({ page }) => {
  555. await page.goto('/chat/session-demo')
  556. const image = page.locator('.markdown img[alt="夭夭 Logo"]')
  557. await expect(image).toBeVisible()
  558. await image.click()
  559. const mediaDialog = page.getByRole('dialog', { name: /预览 AppIcon-1024.png/ })
  560. await expect(mediaDialog).toBeVisible()
  561. await expect(mediaDialog.getByRole('button', { name: '下一张媒体' })).toBeVisible()
  562. await mediaDialog.getByRole('button', { name: '下一张媒体' }).click()
  563. await expect(mediaDialog.locator('img')).toHaveAttribute('src', /variant=2/)
  564. await page.keyboard.press('ArrowLeft')
  565. await expect(mediaDialog.locator('img')).not.toHaveAttribute('src', /variant=2/)
  566. await expect(mediaDialog.getByRole('link', { name: /下载 AppIcon-1024\.png/ })).toBeVisible()
  567. await page.keyboard.press('Escape')
  568. await expect(page.getByRole('dialog', { name: /预览 AppIcon-1024.png/ })).toBeHidden()
  569. await image.click()
  570. const reopenedMediaDialog = page.getByRole('dialog', { name: /预览 AppIcon-1024.png/ })
  571. await reopenedMediaDialog.getByRole('button', { name: '添加到聊天' }).click()
  572. await expect(reopenedMediaDialog).toBeHidden()
  573. await expect(page.locator('.composer-attachments img[alt="AppIcon-1024.png"]')).toBeVisible()
  574. await page.getByRole('button', { name: '团队' }).click()
  575. await expect(page.locator('.markdown img[alt="AppIcon-1024.png"]')).toBeVisible()
  576. })
  577. test('selects existing group topics and creates a new protocol v4 topic on first send', async ({ page }) => {
  578. const roomId = '22222222-2222-4222-8222-222222222222'
  579. const existingTopicId = '88888888-8888-4888-8888-888888888888'
  580. const existingTopicSidebarId = `topic:${roomId}:${existingTopicId}`
  581. await page.getByRole('button', { name: '团队' }).click()
  582. const sidebar = page.locator('.desktop-sidebar')
  583. const existingTopic = sidebar.locator(`[data-sidebar-id="${existingTopicSidebarId}"]`)
  584. await expect(sidebar.getByRole('button', { name: '返回对话' })).toBeVisible()
  585. await expect(sidebar.getByRole('button', { name: '折叠侧边栏' })).toBeVisible()
  586. await expect(sidebar.getByText('话题列表', { exact: true })).toBeVisible()
  587. await expect(sidebar.getByRole('button', { name: '搜索', exact: true })).toBeVisible()
  588. await expect(sidebar.getByRole('button', { name: '新建话题' })).toBeVisible()
  589. await expect(sidebar.getByRole('button', { name: '新建团队' })).toBeVisible()
  590. await expect(sidebar.getByRole('button', { name: '对话', exact: true })).toBeVisible()
  591. await expect(sidebar.locator('.sidebar-footer')).toBeVisible()
  592. await expect(existingTopic).toContainText('发布检查')
  593. await expect(existingTopic).toHaveClass(/sidebar-item--topic/)
  594. const existingTopicRequest = page.waitForRequest(request => {
  595. const url = new URL(request.url())
  596. return request.method() === 'GET'
  597. && url.pathname === `/api/app/groups/rooms/${roomId}/messages`
  598. && url.searchParams.get('topicId') === existingTopicId
  599. })
  600. const existingTopicRead = page.waitForRequest(request => {
  601. const url = new URL(request.url())
  602. return request.method() === 'PATCH'
  603. && url.pathname === `/api/app/groups/rooms/${roomId}/topics/${existingTopicId}/read`
  604. })
  605. await existingTopic.click()
  606. await existingTopicRequest
  607. expect((await existingTopicRead).postDataJSON()).toMatchObject({ throughSeq: 3 })
  608. await expect(page).toHaveURL(new RegExp(`/groups/${roomId}/${existingTopicId}$`))
  609. const timeline = page.locator('.message-stack')
  610. await expect(timeline.getByText('请核对发布话题的独立历史。', { exact: true })).toBeVisible()
  611. await expect(timeline.getByText('大家好,检查一下群聊输入框。', { exact: true })).toHaveCount(0)
  612. await sidebar.getByRole('button', { name: '新建话题' }).click()
  613. const teamPicker = page.getByRole('dialog', { name: '选择团队' })
  614. await expect(teamPicker).toBeVisible()
  615. await teamPicker.locator('.topic-team-picker__choose').filter({ hasText: '设计与工程协作' }).click()
  616. const draftTopic = sidebar.locator('.sidebar-item--topic').filter({ hasText: '新话题' })
  617. await expect(draftTopic).toBeVisible()
  618. const draftSidebarId = await draftTopic.getAttribute('data-sidebar-id')
  619. const newTopicId = draftSidebarId?.split(':').at(-1) || ''
  620. expect(newTopicId).toMatch(/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i)
  621. expect(newTopicId).not.toBe(existingTopicId)
  622. await expect(page).toHaveURL(new RegExp(`/groups/${roomId}/${newTopicId}$`))
  623. const content = '新的发布验收话题'
  624. const sendRequestPromise = page.waitForRequest(request => {
  625. const url = new URL(request.url())
  626. return request.method() === 'POST' && url.pathname === `/api/app/groups/rooms/${roomId}/messages`
  627. })
  628. await page.getByRole('textbox', { name: '发消息给团队,输入 @ 提及 Agent' }).fill(content)
  629. await page.getByRole('button', { name: '发送消息' }).click()
  630. const sendRequest = await sendRequestPromise
  631. const sentPayload = sendRequest.postDataJSON() as { topicId: string; content: string; clientMessageId: string }
  632. expect(sentPayload).toMatchObject({ topicId: newTopicId, content })
  633. const createdTopic = sidebar.locator(`[data-sidebar-id="topic:${roomId}:${newTopicId}"]`)
  634. const sentMessage = page.locator(`[data-message-id="${sentPayload.clientMessageId}"]`)
  635. await expect(createdTopic).toContainText(content)
  636. await expect(sentMessage).toContainText(content)
  637. await page.reload()
  638. await expect(createdTopic).toContainText(content)
  639. await expect(sentMessage).toContainText(content)
  640. })
  641. test('renders persisted user file markers as attachment cards', async ({ page }) => {
  642. await page.goto('/chat/session-demo?profile=yaoyao')
  643. const userMessage = page.locator('[data-message-id="message-user-file"]')
  644. await expect(userMessage).toContainText('查看附件')
  645. await expect(userMessage.getByRole('button', { name: /测试报告\.docx/ })).toBeVisible()
  646. await expect(userMessage).not.toContainText('@file:')
  647. await expect(userMessage).not.toContainText('用户附加文件')
  648. })
  649. test('renders persisted user image markers as direct images instead of file cards', async ({ page }) => {
  650. await page.goto('/chat/session-demo?profile=yaoyao')
  651. const userMessage = page.locator('[data-message-id="message-user-image"]')
  652. const imageAttachment = userMessage.locator('.message__attachment--image')
  653. await expect(imageAttachment).toBeVisible()
  654. await expect(imageAttachment.locator('img[alt="测试图片.png"]')).toBeVisible()
  655. await expect(imageAttachment.locator('strong')).toHaveCount(0)
  656. await expect(imageAttachment).toHaveCSS('background-color', 'rgba(0, 0, 0, 0)')
  657. await expect(userMessage).not.toContainText('@image:')
  658. await expect(userMessage).not.toContainText('[screenshot]')
  659. await imageAttachment.click()
  660. await expect(page.getByRole('dialog', { name: '预览 测试图片.png' })).toBeVisible()
  661. })
  662. test('folds tool result rows into their expandable tool call', async ({ page }) => {
  663. await page.goto('/chat/session-demo')
  664. const trace = page.locator('.turn-trace').first()
  665. await expect(trace).not.toHaveAttribute('open', '')
  666. await expect(trace).toHaveCSS('background-color', 'rgba(0, 0, 0, 0)')
  667. await expect(trace.locator('summary')).toContainText('思考与工具')
  668. await expect(trace.locator('summary')).toContainText('2 段思考 · 2 个工具')
  669. await expect(trace.locator('summary > :last-child')).toHaveClass(/turn-trace__caret/)
  670. await trace.locator('summary').click()
  671. await expect(trace).not.toHaveCSS('background-color', 'rgba(0, 0, 0, 0)')
  672. await expect(trace.locator('.turn-trace__reasoning')).toHaveCount(2)
  673. await expect(trace.locator('.tool-trace')).toHaveCount(2)
  674. await expect(trace.locator('.tool-trace > button > :last-child.tool-trace__caret')).toHaveCount(2)
  675. await expect(trace.locator('.tool-trace__details')).toHaveCount(2)
  676. await expect(trace.locator('.tool-trace__details').filter({ hasText: '/tmp/demo-report.pdf' })).toBeVisible()
  677. await expect(trace.locator('.tool-trace__details pre').first()).toHaveCSS('max-height', 'none')
  678. await expect(trace.locator('.tool-trace__details pre').first()).toHaveCSS('overflow-y', 'visible')
  679. const traceContent = trace.locator('.turn-trace__content')
  680. await expect(traceContent).toHaveCSS('overflow-y', 'auto')
  681. await expect(traceContent.locator(':scope > .turn-trace__item')).toHaveCount(4)
  682. const layout = await traceContent.evaluate(element => {
  683. const items = [...element.children] as HTMLElement[]
  684. return {
  685. maxHeight: Number.parseFloat(getComputedStyle(element).maxHeight),
  686. leftOffsets: items.map(item => item.offsetLeft),
  687. }
  688. })
  689. expect(layout.maxHeight).toBeLessThanOrEqual(420)
  690. expect(new Set(layout.leftOffsets).size).toBe(1)
  691. const toolAlignment = await trace.locator('.tool-trace').first().evaluate(element => {
  692. const tool = element as HTMLElement
  693. const button = tool.querySelector<HTMLElement>(':scope > button')
  694. const detail = tool.querySelector<HTMLElement>('.tool-trace__details > section')
  695. return {
  696. toolLeft: tool.getBoundingClientRect().left,
  697. buttonLeft: button?.getBoundingClientRect().left,
  698. detailLeft: detail?.getBoundingClientRect().left,
  699. }
  700. })
  701. expect(toolAlignment.buttonLeft).toBeCloseTo(toolAlignment.toolLeft, 0)
  702. expect(toolAlignment.detailLeft).toBeCloseTo(toolAlignment.toolLeft, 0)
  703. await expect(page.locator('[data-message-id="message-tool-call"]')).toHaveCount(0)
  704. await expect(page.locator('.message--tool')).toHaveCount(0)
  705. })
  706. test('renders subtask completion as a collapsed timeline event', async ({ page }) => {
  707. await page.goto('/chat/session-demo')
  708. await expect(page.getByText('子任务已完成', { exact: true })).toBeVisible()
  709. const delegation = page.locator('.delegation-event').filter({ hasText: '子任务已完成' })
  710. await expect(delegation).toContainText('2 个子任务 · 2 已完成')
  711. await expect(delegation).not.toHaveAttribute('open', '')
  712. })
  713. test('renders background process exits as collapsed system events', async ({ page }) => {
  714. await page.goto('/chat/session-demo')
  715. const event = page.locator('[data-message-id="message-background-process"] .background-process-event')
  716. const detail = event.locator('.markdown')
  717. await expect(event).toContainText('后台子任务已终止 · SIGTERM')
  718. await expect(event).not.toHaveAttribute('open', '')
  719. await expect(detail).toBeHidden()
  720. await event.locator('summary').click()
  721. await expect(detail).toBeVisible()
  722. await expect(detail).toContainText('Command: ./run_mac.sh')
  723. await expect(page.locator('[data-message-id="message-background-process"]')).toHaveClass(/message--system/)
  724. })
  725. test('renders context compaction as a collapsed timeline event', async ({ page }) => {
  726. await page.goto('/chat/session-demo')
  727. const compaction = page.locator('[data-message-id="message-compaction"] .compaction-event')
  728. await expect(compaction).toContainText('上下文已压缩')
  729. await expect(compaction).toContainText('压缩摘要已归档 · 点击查看')
  730. await expect(compaction).not.toHaveAttribute('open', '')
  731. await expect(compaction.getByText('Historical Task Snapshot', { exact: true })).toBeHidden()
  732. await compaction.locator('summary').click()
  733. await expect(compaction.getByText('Historical Task Snapshot', { exact: true })).toBeVisible()
  734. await expect(page.locator('[data-message-id="message-compaction"]')).toHaveClass(/message--system/)
  735. })
  736. test('renders model changes as a collapsed system event', async ({ page }) => {
  737. await page.goto('/chat/session-demo')
  738. const modelEvent = page.locator('.system-event').filter({ hasText: '模型已切换:gpt-5.6-terra' })
  739. await expect(modelEvent.getByText('模型已切换:gpt-5.6-terra', { exact: true })).toBeVisible()
  740. await expect(modelEvent).not.toHaveAttribute('open', '')
  741. })
  742. test('opens a local message file link as a floating preview card', async ({ page }) => {
  743. await page.route('**/Users/samien/Agents/%E6%96%B9%E6%A1%88%E8%8D%89%E7%A8%BF.md', route => route.fulfill({
  744. status: 200,
  745. contentType: 'text/markdown',
  746. body: '# 会话文件\n\n这是会话中的文本文件。',
  747. }))
  748. await page.goto('/chat/session-demo')
  749. const card = page.getByRole('link', { name: '预览文件 方案草稿.md' })
  750. await expect(card).toHaveClass(/file-link-card/)
  751. await card.click()
  752. const dialog = page.getByRole('dialog', { name: '预览 方案草稿.md' })
  753. await expect(dialog).toBeVisible()
  754. await expect(dialog.locator('.preview-text')).toBeVisible()
  755. const textPadding = await dialog.locator('.preview-text').evaluate(element => {
  756. const style = getComputedStyle(element)
  757. return { left: Number.parseFloat(style.paddingLeft), right: Number.parseFloat(style.paddingRight) }
  758. })
  759. expect(textPadding.left).toBeGreaterThanOrEqual(24)
  760. expect(textPadding.right).toBeGreaterThanOrEqual(24)
  761. const stageHeight = await dialog.locator('.preview-stage').evaluate(stage => stage.getBoundingClientRect().height)
  762. expect(stageHeight).toBeGreaterThan(500)
  763. })
  764. test('shows a thinking animation after submit until output starts', async ({ page }) => {
  765. await page.goto('/chat/session-demo?profile=yaoyao')
  766. await page.locator('.composer-textarea').fill('请开始思考')
  767. await page.getByRole('button', { name: '发送消息' }).click()
  768. await expect(page.locator('.thinking-indicator')).toBeVisible()
  769. await expect(page.getByText('这是来自假 Gateway 的流式回复。', { exact: true })).toBeVisible()
  770. await expect(page.locator('.thinking-indicator')).toHaveCount(0)
  771. })
  772. test('uses HTTP commands and SSE for chat and team events without opening client WebSockets', async ({ page }, testInfo) => {
  773. const sockets: string[] = [], paths: string[] = []
  774. page.on('websocket', socket => sockets.push(socket.url()))
  775. page.on('request', request => paths.push(new URL(request.url()).pathname))
  776. await page.goto('/chat/session-demo?profile=yaoyao')
  777. await page.locator('.composer-textarea').fill('验证 HTTP SSE 入口')
  778. await page.getByRole('button', { name: '发送消息' }).click()
  779. await expect(page.getByText('这是来自假 Gateway 的流式回复。', { exact: true })).toBeVisible()
  780. expect(paths.some(path => /^\/api\/realtime\/channels\/[^/]+\/commands$/.test(path))).toBe(true)
  781. expect(paths.some(path => /^\/api\/realtime\/channels\/[^/]+\/events$/.test(path))).toBe(true)
  782. await page.screenshot({ path: testInfo.outputPath('http-sse-chat.png'), fullPage: true })
  783. await page.getByRole('button', { name: '团队', exact: true }).click()
  784. await page.getByRole('option').filter({ hasText: '设计验收' }).click()
  785. await expect(page.getByRole('heading', { name: '设计验收' })).toBeVisible()
  786. expect(sockets).toEqual([])
  787. await page.screenshot({ path: testInfo.outputPath('http-sse-team.png'), fullPage: true })
  788. })
  789. test('keeps streamed text below sealed interim commentary and its tool trace', async ({ page }) => {
  790. await page.goto('/chat/session-demo?profile=yaoyao')
  791. await page.locator('.composer-textarea').fill('验证流式分段')
  792. await page.getByRole('button', { name: '发送消息' }).click()
  793. const interim = page.locator('.message--assistant').filter({ hasText: '我先检查配置。' }).last()
  794. const current = page.locator('.message--assistant').filter({ hasText: '配置检查完成。' }).last()
  795. const trace = page.locator('.turn-trace').last()
  796. await expect(interim).toBeVisible()
  797. await expect(trace).toHaveClass(/turn-trace--running/)
  798. await expect(page.locator('.thinking-indicator')).toBeVisible()
  799. await expect(current).toBeVisible()
  800. const [interimBox, traceBox, currentBox] = await Promise.all([
  801. interim.boundingBox(), trace.boundingBox(), current.boundingBox(),
  802. ])
  803. expect(interimBox?.y).toBeLessThan(traceBox?.y ?? 0)
  804. expect(traceBox?.y).toBeLessThan(currentBox?.y ?? 0)
  805. await expect(trace).toHaveClass(/turn-trace--success/)
  806. await expect(page.getByText('配置检查完成。', { exact: true })).toHaveCount(1)
  807. })
  808. test('keeps the canonical logo and yaoyao-webui composer geometry', async ({ page }) => {
  809. const logo = page.locator('.rail__brand img')
  810. await expect(logo).toHaveAttribute('src', '/brand/AppIcon-1024.png')
  811. const emptyLogo = page.locator('.new-chat-empty__logo')
  812. await expect(emptyLogo).toHaveAttribute('src', '/brand/AppIcon-1024.png')
  813. await expect(page.getByText('聊点什么', { exact: true })).toBeVisible()
  814. await expect(page.locator('.timeline-header')).toHaveClass(/timeline-header--transparent/)
  815. await expect(page.locator('.composer-context')).toContainText('剩余 256.0k')
  816. await page.getByRole('button', { name: '推理强度:默认' }).click()
  817. await expect(page.locator('.composer-popover--reasoning')).toBeVisible()
  818. await page.getByRole('button', { name: '设置', exact: true }).click()
  819. await expect(page.locator('.composer-popover--settings')).toBeVisible()
  820. await expect(page.getByText('语音输入设置', { exact: true })).toBeVisible()
  821. await page.locator('.composer-shell').click()
  822. await page.getByRole('option').first().click()
  823. await expect(page.locator('.timeline')).toHaveCSS('background-color', 'rgb(255, 255, 255)')
  824. await expect(page.locator('.message--assistant .message__avatar')).toHaveCount(0)
  825. await expect(page.locator('.message--assistant .message__meta')).toHaveCount(0)
  826. const assistantMessage = page.locator('.message--assistant-anonymous:not(.message--tool-only)').first()
  827. await page.mouse.move(1200, 20)
  828. await expect(assistantMessage.locator('.message__actions')).toHaveCSS('opacity', '0')
  829. await assistantMessage.hover()
  830. await expect(assistantMessage.locator('.message__actions')).toHaveCSS('opacity', '1')
  831. await expect(page.locator('.message--tool-only .message__actions')).toHaveCount(0)
  832. await expect(page.locator('[data-message-id="message-thinking-tool"]')).toHaveCount(0)
  833. await expect(page.locator('.turn-trace')).toHaveCount(1)
  834. const userMessageMeta = page.locator('.message--user .message__meta')
  835. await expect(userMessageMeta).not.toHaveCount(0)
  836. expect(await userMessageMeta.evaluateAll(elements => elements.every(element => getComputedStyle(element).display === 'none'))).toBe(true)
  837. await expect(page.getByRole('button', { name: '会话操作' })).toBeVisible()
  838. await page.getByRole('button', { name: '会话操作' }).click()
  839. const sessionMenu = page.getByRole('menu', { name: '会话操作' })
  840. await expect(sessionMenu.getByText('会话大纲', { exact: true })).toBeVisible()
  841. await sessionMenu.getByText('会话大纲', { exact: true }).click()
  842. const outline = page.getByRole('navigation', { name: '会话大纲' })
  843. await expect(outline).toBeVisible()
  844. await expect(outline.getByText('请检查今天生成的产物。MEDIA:/brand/AppIcon-1024.png', { exact: true })).toBeVisible()
  845. await expect(outline.getByText('验收摘要', { exact: true })).toBeVisible()
  846. await outline.getByRole('button', { name: '跳转到 验收摘要' }).click()
  847. await expect(page.locator('[data-message-id="message-assistant"]')).toHaveClass(/message--revealed/)
  848. await page.getByRole('button', { name: '关闭会话大纲' }).click()
  849. await expect(outline).toBeHidden()
  850. await page.getByRole('button', { name: '会话操作' }).click()
  851. await expect(sessionMenu.getByText('取消置顶', { exact: true })).toBeVisible()
  852. const unpinIcon = sessionMenu.getByRole('menuitem', { name: '取消置顶' }).locator('.app-icon')
  853. await expect(unpinIcon.locator('path')).toHaveCount(2)
  854. await expect(unpinIcon.locator('path').last()).toHaveAttribute('d', 'M4 4l16 16')
  855. await expect(page.locator('.desktop-sidebar .sidebar-item--single-line').first().locator('.app-icon path')).toHaveAttribute('fill', 'currentColor')
  856. await expect(sessionMenu.getByText('重命名', { exact: true })).toBeVisible()
  857. await expect(sessionMenu.getByText('删除会话', { exact: true })).toBeVisible()
  858. await expect(page.getByText('置顶会话', { exact: true })).toHaveCount(0)
  859. const menuBox = await sessionMenu.evaluate(element => element.getBoundingClientRect().toJSON())
  860. expect(menuBox.width).toBeLessThanOrEqual(220)
  861. expect(menuBox.height).toBeLessThan(165)
  862. await expect(page.locator('.session-action-layer')).toHaveCount(0)
  863. await sessionMenu.getByText('取消置顶', { exact: true }).click()
  864. await expect(page.locator('.desktop-sidebar').getByText('已置顶 1', { exact: true })).toHaveCount(0)
  865. await page.getByRole('button', { name: '会话操作' }).click()
  866. await sessionMenu.getByText('置顶会话', { exact: true }).click()
  867. await expect(page.locator('.desktop-sidebar').getByText('已置顶 1', { exact: true })).toBeVisible()
  868. const compactSession = page.locator('.desktop-sidebar .sidebar-item--single-line').first()
  869. const compactMetrics = await compactSession.evaluate(element => {
  870. const title = element.querySelector('strong')
  871. return {
  872. height: element.getBoundingClientRect().height,
  873. weight: title ? Number(getComputedStyle(title).fontWeight) : 0,
  874. }
  875. })
  876. expect(compactMetrics.height).toBeLessThanOrEqual(31)
  877. expect(compactMetrics.weight).toBeLessThan(500)
  878. await compactSession.click({ button: 'right' })
  879. await expect(sessionMenu).toBeVisible()
  880. await page.keyboard.press('Escape')
  881. const composer = page.locator('.composer-shell')
  882. await expect(composer).toBeVisible()
  883. const geometry = await composer.evaluate(element => {
  884. const rect = element.getBoundingClientRect()
  885. const style = getComputedStyle(element)
  886. return { width: rect.width, minHeight: style.minHeight, radius: style.borderRadius }
  887. })
  888. expect(geometry.width).toBeLessThanOrEqual(760)
  889. expect(geometry.minHeight).toBe('72px')
  890. expect(geometry.radius).toBe('18px')
  891. const send = page.getByRole('button', { name: '发送消息' })
  892. await expect(send).toHaveCSS('width', '34px')
  893. await expect(send).toHaveCSS('height', '34px')
  894. })
  895. test('uses the unified Grok-style sidebar, search trigger, and persistent collapse', async ({ page }) => {
  896. const sidebar = page.locator('.desktop-sidebar')
  897. await expect(sidebar).toBeVisible()
  898. await expect(sidebar).toHaveCSS('width', '264px')
  899. await expect(sidebar.locator('.brand-mark__name')).toHaveCount(0)
  900. await expect(sidebar.locator('.profile-switcher')).toHaveCount(0)
  901. await expect(sidebar.locator('.sidebar-account-switcher')).toHaveCount(1)
  902. await expect(page.getByRole('button', { name: '搜索', exact: true })).toBeVisible()
  903. await expect(page.getByRole('button', { name: '新建聊天', exact: true })).toBeVisible()
  904. await expect(page.getByRole('button', { name: '新建聊天', exact: true })).toHaveCSS('background-color', 'rgba(0, 0, 0, 0)')
  905. await expect(page.getByRole('button', { name: '新建聊天', exact: true })).toHaveCSS('font-weight', '650')
  906. await expect(sidebar.getByText('历史记录', { exact: true })).toBeVisible()
  907. const searchTrigger = page.getByRole('button', { name: '搜索', exact: true })
  908. await searchTrigger.click()
  909. const searchDialog = page.getByRole('dialog', { name: '搜索会话' })
  910. await expect(searchDialog).toBeVisible()
  911. const search = searchDialog.getByPlaceholder('搜索会话')
  912. await expect(search).toBeVisible()
  913. await expect(sidebar.locator('.sidebar-search')).toHaveCount(0)
  914. const originalSessionCount = await sidebar.getByRole('option').count()
  915. await search.fill('验收')
  916. const sessionResult = searchDialog.getByRole('option', { name: /夭夭 Web 验收会话/ })
  917. await expect(sessionResult).toBeVisible()
  918. await expect(sidebar.getByRole('option')).toHaveCount(originalSessionCount)
  919. await sessionResult.click()
  920. await expect(page).toHaveURL(/\/chat\/session-demo\?profile=yaoyao/)
  921. await expect(searchDialog).toBeHidden()
  922. await expect(searchTrigger).toBeVisible()
  923. await expect(searchTrigger).toHaveAttribute('aria-expanded', 'false')
  924. await page.getByRole('button', { name: '折叠侧边栏' }).click()
  925. await expect(sidebar).toHaveCSS('width', '68px')
  926. const collapseBox = await page.getByRole('button', { name: '展开侧边栏' }).boundingBox()
  927. const accountBox = await sidebar.locator('.sidebar-account-switcher__main').boundingBox()
  928. expect(collapseBox?.y).toBeLessThan(accountBox?.y ?? 0)
  929. await expect(sidebar.getByText('历史记录', { exact: true })).toBeHidden()
  930. await expect(page.getByRole('button', { name: '搜索', exact: true })).toBeVisible()
  931. await expect(page.getByRole('button', { name: '新建聊天', exact: true })).toBeVisible()
  932. await page.reload()
  933. await expect(sidebar).toHaveCSS('width', '68px')
  934. await page.getByRole('button', { name: '搜索', exact: true }).click()
  935. await expect(sidebar).toHaveCSS('width', '264px')
  936. await expect(page.getByRole('dialog', { name: '搜索会话' })).toBeVisible()
  937. })
  938. test('uses the mobile composer and keeps the closed drawer inert', async ({ page }) => {
  939. await page.setViewportSize({ width: 390, height: 844 })
  940. await page.reload()
  941. await expect(page.getByRole('navigation')).not.toBeVisible()
  942. const drawer = page.locator('.mobile-drawer')
  943. await expect(drawer).toHaveAttribute('aria-hidden', 'true')
  944. await expect(drawer).toHaveAttribute('inert', '')
  945. await expect(page.locator('.mobile-header .brand-mark__plate')).toBeVisible()
  946. await expect(page.locator('.mobile-header .brand-mark__name')).toHaveCount(0)
  947. await page.getByRole('button', { name: '打开导航' }).click()
  948. await expect(drawer.locator('.brand-mark__plate')).toBeVisible()
  949. await expect(drawer.locator('.brand-mark__name')).toHaveCount(0)
  950. await expect(page.locator('.composer-shell')).toHaveCSS('min-height', '118px')
  951. await expect(page.locator('.composer-textarea')).toHaveCSS('font-size', '16px')
  952. })
  953. test('renders the Kanban snapshot and mobile status control without page overflow', async ({ page }) => {
  954. await page.getByRole('button', { name: '看板', exact: true }).click()
  955. await expect(page).toHaveURL(/\/kanban\/default$/)
  956. await expect(page).toHaveTitle('产品研发 · 夭夭')
  957. await expect(page.getByRole('heading', { name: '产品研发', exact: true })).toBeVisible()
  958. await expect(page.getByRole('article', { name: /完成 Web 看板验收/ })).toBeVisible()
  959. await expect(page.locator('.kanban-column')).toHaveCount(8)
  960. await page.getByRole('article', { name: /完成 Web 看板验收/ }).click()
  961. await expect(page.getByRole('heading', { name: '完成 Web 看板验收', exact: true })).toBeVisible()
  962. await expect(page.getByText('请保留真实浏览器验收证据。', { exact: true })).toBeVisible()
  963. await expect(page.locator('.kanban-task-drawer').getByText('正在执行浏览器验收', { exact: true }).first()).toBeVisible()
  964. await page.getByRole('button', { name: '关闭任务详情' }).click()
  965. await page.setViewportSize({ width: 390, height: 844 })
  966. await page.reload()
  967. await expect(page.getByRole('button', { name: '立即调度', exact: true })).toBeVisible()
  968. const card = page.getByRole('article', { name: /完成 Web 看板验收/ })
  969. await expect(card).toBeVisible()
  970. await expect(card.locator('.kanban-card__mobile-status select')).toBeVisible()
  971. const geometry = await page.evaluate(() => ({
  972. viewport: window.innerWidth,
  973. page: document.documentElement.scrollWidth,
  974. board: document.querySelector('.kanban-columns')?.scrollWidth || 0,
  975. }))
  976. expect(geometry.page).toBe(geometry.viewport)
  977. expect(geometry.board).toBeGreaterThan(geometry.viewport)
  978. })