Browse Source

更新发布验收以覆盖电脑标签与列表操作并隔离文件断言

LSamien 1 month ago
parent
commit
d86fd2a331
2 changed files with 14 additions and 6 deletions
  1. 3 1
      tests/e2e/team-tools.spec.ts
  2. 11 5
      tests/e2e/workspace-chat.spec.ts

+ 3 - 1
tests/e2e/team-tools.spec.ts

@@ -122,7 +122,9 @@ test('configures the Agent computer in its chat panel and keeps preparation in a
  await editor.getByRole('button',{name:'保存',exact:true}).click()
  await page.getByRole('button',{name:'电脑',exact:true}).click()
  const dock=page.getByRole('complementary',{name:'Agent 电脑面板'})
- await dock.getByRole('combobox',{name:'此 Agent 使用的电脑'}).selectOption('vm')
+ const vmTab=dock.getByRole('tab',{name:'本地虚拟机',exact:true})
+ await vmTab.click()
+ await expect(vmTab).toHaveAttribute('aria-selected','true')
  await expect(dock.getByRole('button',{name:'设置本地虚拟机',exact:true})).toBeVisible()
  await page.screenshot({path:testInfo.outputPath('local-vm-unconfigured-agent.png')})
 })

+ 11 - 5
tests/e2e/workspace-chat.spec.ts

@@ -263,8 +263,12 @@ test('created roles and editable teams share a durable chat list without plugin
   await expect(textPreview).toBeVisible()
   await expect(textPreview).toContainText('Fixture report')
   await textPreview.getByRole('button', { name: '关闭预览' }).click()
-  await page.getByRole('button', {name:'置顶聊天',exact:true}).click()
-  await expect(page.getByRole('button', {name:'取消置顶',exact:true})).toBeVisible()
+  const managerRow = rail.getByRole('option').filter({ hasText: '产品经理' })
+  await managerRow.click({ button: 'right' })
+  await page.getByRole('menuitem', {name:'置顶聊天',exact:true}).click()
+  await managerRow.click({ button: 'right' })
+  await expect(page.getByRole('menuitem', {name:'取消置顶',exact:true})).toBeVisible()
+  await page.getByRole('menuitem', {name:'取消置顶',exact:true}).press('Escape')
   const directURL = page.url()
   await createAgent(page, '开发工程师')
   await expect(page.locator('.message')).toHaveCount(0)
@@ -336,7 +340,8 @@ test('created roles and editable teams share a durable chat list without plugin
   await page.goto('/files')
   await page.getByRole('button',{name:'查看来源',exact:true}).first().click()
   await expect(page).toHaveURL(groupURL)
-  await page.getByRole('button', { name: '归档聊天', exact: true }).click()
+  await groupRow.click({ button: 'right' })
+  await page.getByRole('menuitem', { name: '归档聊天', exact: true }).click()
   await expect(page.locator('.desktop-sidebar .sidebar-item')).toHaveCount(3)
   await page.locator('.desktop-sidebar .sidebar-search-trigger').click()
   const search = page.getByRole('dialog', { name: '搜索聊天', exact: true })
@@ -349,7 +354,7 @@ test('created roles and editable teams share a durable chat list without plugin
   await page.screenshot({ path: testInfo.outputPath('archived-chat-search.png'), fullPage: true })
   await search.getByRole('option').click()
   await expect(search).not.toBeVisible()
-  await page.getByRole('button', { name: '恢复聊天', exact: true }).click()
+  await expect(page.getByPlaceholder('输入消息,Enter 发送,Shift + Enter 换行')).toBeDisabled()
   await page.goto(directURL)
   await expect(page.locator('.message--assistant')).toHaveCount(1)
   await expect(page.locator('.message--assistant')).toContainText('我是产品经理')
@@ -533,7 +538,8 @@ test('only chat messages introduce files across transcript and library', async (
   await process.locator('summary').first().click()
   await expect(process).toContainText('/tmp/process.pdf')
   await expect(process.locator('img, .file-link-card')).toHaveCount(0)
-  const files = await (await page.request.get('/api/app/files')).json()
+  const conversationId = new URL(page.url()).pathname.split('/').at(-1)!
+  const files = await (await page.request.get(`/api/app/files?session_id=${encodeURIComponent(conversationId)}`)).json()
   expect(files.items.map((file: { name: string }) => file.name)).toEqual(['workspace-report.txt'])
   await report.click()
   const preview = page.getByRole('dialog', { name: '预览 workspace-report.txt', exact: true })