فهرست منبع

修复发布回归夹具:同步快照与事件流协议并等待登录页

Samien 1 ماه پیش
والد
کامیت
076cd416f2

+ 1 - 1
tests/client/conversationDeliveryMode.test.ts

@@ -21,7 +21,7 @@ it.each([true, false])('sends the selected delivery mode through the real compos
   vi.stubGlobal('EventSource', class { addEventListener() {} close() {} })
   vi.mocked(apiRequest).mockImplementation(async (path, options) => {
     if (path === '/api/app/capabilities') return { features: [], csrfToken: 'fixture' } as never
-    if (path === '/api/app/workspace/snapshot') return { agents, conversations: [group], cursor: 1, details: [] } as never
+    if (path.split('?')[0] === '/api/app/workspace/snapshot') return { agents, conversations: [group], cursor: 1, details: [] } as never
     if (path === '/api/app/agents') return { agents } as never
     if (path === '/api/app/agents/sources') return { sources: [] } as never
     if (path === '/api/app/conversations') return { conversations: [group], cursor: 1 } as never

+ 5 - 5
tests/client/conversationRecovery.test.ts

@@ -43,13 +43,13 @@ async function mountView(path = '/conversations', stubTimeline = false) {
 }
 function successfulResponse(path: string) {
   if (path === '/api/app/capabilities') return { features: [] }
-  if (path === '/api/app/workspace/snapshot') return { agents: [], conversations: [], details: [], cursor: 17 }
+  if (path.split('?')[0] === '/api/app/workspace/snapshot') return { agents: [], conversations: [], details: [], cursor: 17 }
   throw new Error(`Unexpected request ${path}`)
 }
 it.each([undefined, null, { agents: [], conversations: [], details: [] }])('recovers incomplete Bot initialization data without requiring a virtual machine', async snapshot => {
   let snapshots = 0
   vi.mocked(apiRequest).mockImplementation(async path => {
-    if (path === '/api/app/workspace/snapshot' && snapshots++ === 0) return snapshot as never
+    if (path.split('?')[0] === '/api/app/workspace/snapshot' && snapshots++ === 0) return snapshot as never
     return successfulResponse(path) as never
   })
   await mountView()
@@ -57,7 +57,7 @@ it.each([undefined, null, { agents: [], conversations: [], details: [] }])('reco
   expect(wrapper!.get('[role="alert"]').text()).toContain('Bot 会话数据尚未就绪')
   expect(wrapper!.text()).not.toContain('TypeError')
   await vi.advanceTimersByTimeAsync(1500); await flushPromises()
-  expect(sources.map(source => source.url)).toEqual(['/api/app/events/stream?after=17'])
+  expect(sources.map(source => source.url)).toEqual(['/api/app/events/stream?after=17&toolDetails=lazy'])
   expect(vi.mocked(apiRequest).mock.calls.some(([path]) => /local-vm|computer/.test(path))).toBe(false)
 })
 it('recovers an initial server outage while the browser stays online', async () => {
@@ -65,7 +65,7 @@ it('recovers an initial server outage while the browser stays online', async ()
   await mountView()
   expect(sources).toHaveLength(0)
   await vi.advanceTimersByTimeAsync(1500); await flushPromises()
-  expect(sources.map(source => source.url)).toEqual(['/api/app/events/stream?after=17'])
+  expect(sources.map(source => source.url)).toEqual(['/api/app/events/stream?after=17&toolDetails=lazy'])
   expect(vi.mocked(apiRequest).mock.calls.filter(([path]) => path === '/api/app/capabilities')).toHaveLength(2)
 })
 it('cancels a scheduled initial recovery when the view is destroyed', async () => {
@@ -101,7 +101,7 @@ it('cancels recovery while offline and restarts it only when connectivity return
   await vi.advanceTimersByTimeAsync(10_000)
   expect(apiRequest).toHaveBeenCalledTimes(1)
   online = true; window.dispatchEvent(new Event('online')); await flushPromises()
-  expect(sources.map(source => source.url)).toEqual(['/api/app/events/stream?after=17'])
+  expect(sources.map(source => source.url)).toEqual(['/api/app/events/stream?after=17&toolDetails=lazy'])
 })
 it('aborts a pending detail on going offline and ignores its late response', async () => {
   let online = true, signal: AbortSignal | undefined, release!: (value: unknown) => void

+ 1 - 1
tests/client/conversationSearchDelete.test.ts

@@ -20,7 +20,7 @@ async function setup(kind: 'direct' | 'group', remove: () => Promise<void> = asy
   vi.stubGlobal('EventSource', class { addEventListener() {} close() {} })
   vi.mocked(apiRequest).mockImplementation(async (path, options) => {
     if (path === '/api/app/capabilities') return { features: [], csrfToken: 'fixture-csrf' } as never
-    if (path === '/api/app/workspace/snapshot') return { agents: [{ id: 'bot', name: '旧聊天', archived: true }], conversations: archived, details: [], cursor: 1 } as never
+    if (path.split('?')[0] === '/api/app/workspace/snapshot') return { agents: [{ id: 'bot', name: '旧聊天', archived: true }], conversations: archived, details: [], cursor: 1 } as never
     if (path.endsWith('/lifecycle')) {
       if (options?.method !== 'POST') return { name: '旧聊天', kind, groups, confirmationToken: 'a'.repeat(64) } as never
       await remove()

+ 1 - 1
tests/client/conversationSettings.test.ts

@@ -24,7 +24,7 @@ it.each(['direct', 'group'] as const)('opens and saves the menu target %s while
   vi.stubGlobal('EventSource', class { addEventListener() {} close() {} })
   vi.mocked(apiRequest).mockImplementation(async path => {
     if (path === '/api/app/capabilities') return { features: [], csrfToken: 'fixture-csrf' } as never
-    if (path === '/api/app/workspace/snapshot') return { agents, conversations, cursor: 1, details: [] } as never
+    if (path.split('?')[0] === '/api/app/workspace/snapshot') return { agents, conversations, cursor: 1, details: [] } as never
     if (path === '/api/app/agents') return { agents } as never
     if (path === '/api/app/agents/sources') return { sources: [{ nodeId: 'local', profile: 'default', name: '基础机器人' }] } as never
     if (path === '/api/app/conversations') return { conversations, cursor: 1 } as never

+ 1 - 0
tests/e2e/model-confirmation.spec.ts

@@ -14,6 +14,7 @@ test('model confirmation survives reconnects and failed inputs retain their posi
     await route.fulfill({ json: { state: 'confirmed', response: { result } } })
   })
   await page.goto('/chat/session-demo?profile=yaoyao')
+  await expect(page.getByRole('heading', { name: '登录夭夭' })).toBeVisible()
   if (await page.getByRole('heading', { name: '登录夭夭' }).isVisible()) {
     await page.getByLabel('账号').fill('admin')
     await page.getByLabel('密码').fill('e2e-password')