Просмотр исходного кода

修复发布回归夹具:适配聊天快照参数并等待登录页就绪

Samien 1 месяц назад
Родитель
Сommit
d5e132683e

+ 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.stubGlobal('EventSource', class { addEventListener() {} close() {} })
   vi.mocked(apiRequest).mockImplementation(async (path, options) => {
   vi.mocked(apiRequest).mockImplementation(async (path, options) => {
     if (path === '/api/app/capabilities') return { features: [], csrfToken: 'fixture' } as never
     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') return { agents } as never
     if (path === '/api/app/agents/sources') return { sources: [] } as never
     if (path === '/api/app/agents/sources') return { sources: [] } as never
     if (path === '/api/app/conversations') return { conversations: [group], cursor: 1 } as never
     if (path === '/api/app/conversations') return { conversations: [group], cursor: 1 } as never

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

@@ -43,13 +43,13 @@ async function mountView(path = '/conversations', stubTimeline = false) {
 }
 }
 function successfulResponse(path: string) {
 function successfulResponse(path: string) {
   if (path === '/api/app/capabilities') return { features: [] }
   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}`)
   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 => {
 it.each([undefined, null, { agents: [], conversations: [], details: [] }])('recovers incomplete Bot initialization data without requiring a virtual machine', async snapshot => {
   let snapshots = 0
   let snapshots = 0
   vi.mocked(apiRequest).mockImplementation(async path => {
   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
     return successfulResponse(path) as never
   })
   })
   await mountView()
   await mountView()

+ 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.stubGlobal('EventSource', class { addEventListener() {} close() {} })
   vi.mocked(apiRequest).mockImplementation(async (path, options) => {
   vi.mocked(apiRequest).mockImplementation(async (path, options) => {
     if (path === '/api/app/capabilities') return { features: [], csrfToken: 'fixture-csrf' } as never
     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 (path.endsWith('/lifecycle')) {
       if (options?.method !== 'POST') return { name: '旧聊天', kind, groups, confirmationToken: 'a'.repeat(64) } as never
       if (options?.method !== 'POST') return { name: '旧聊天', kind, groups, confirmationToken: 'a'.repeat(64) } as never
       await remove()
       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.stubGlobal('EventSource', class { addEventListener() {} close() {} })
   vi.mocked(apiRequest).mockImplementation(async path => {
   vi.mocked(apiRequest).mockImplementation(async path => {
     if (path === '/api/app/capabilities') return { features: [], csrfToken: 'fixture-csrf' } as never
     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') return { agents } as never
     if (path === '/api/app/agents/sources') return { sources: [{ nodeId: 'local', profile: 'default', name: '基础机器人' }] } 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
     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 route.fulfill({ json: { state: 'confirmed', response: { result } } })
   })
   })
   await page.goto('/chat/session-demo?profile=yaoyao')
   await page.goto('/chat/session-demo?profile=yaoyao')
+  await expect(page.getByRole('heading', { name: '登录夭夭' })).toBeVisible()
   if (await page.getByRole('heading', { name: '登录夭夭' }).isVisible()) {
   if (await page.getByRole('heading', { name: '登录夭夭' }).isVisible()) {
     await page.getByLabel('账号').fill('admin')
     await page.getByLabel('账号').fill('admin')
     await page.getByLabel('密码').fill('e2e-password')
     await page.getByLabel('密码').fill('e2e-password')