This commit is contained in:
2026-10-24 16:34:02 +08:00
parent 99e5687ce0
commit 7119e04a65
24 changed files with 553 additions and 39 deletions
+41
View File
@@ -45,3 +45,44 @@ test('batch-delete text appears in its confirmation popup without leaking into t
await expect(popup).toContainText(confirmation)
await expect(popup.getByRole('button', { name: /cancel/i })).toBeVisible()
})
for (const path of ['/hermes/chat', '/hermes/session/restored-chat?profile=research']) {
test(`shows conversation before slow profile, settings and model requests finish: ${path}`, async ({ page }) => {
await authenticate(page, TEST_ACCESS_KEY, 'research')
await mockHermesApi(page, { sessions: [session] })
await mockChatSocket(page)
await page.addInitScript(() => {
;(window as any).__PW_CHAT_SOCKET_RESUMES__ = {
'restored-chat': { session_id: 'restored-chat', messages: [{ id: 1, role: 'user', content: 'History without waiting for profiles', timestamp: 1000 }], isWorking: false, events: [] },
}
})
let release!: () => void
const gate = new Promise<void>(resolve => { release = resolve })
await page.route(url => ['/api/hermes/profiles', '/api/hermes/config', '/api/hermes/available-models'].includes(url.pathname), async route => {
await gate
await route.fallback()
})
try {
await page.goto(`/#${path}`)
await expect(page.getByText('History without waiting for profiles', { exact: true })).toBeVisible()
} finally { release() }
})
}
test('falls back to HTTP history and offers retry after a failed load', async ({ page }) => {
await authenticate(page, TEST_ACCESS_KEY, 'research')
await mockHermesApi(page, { sessions: [session] })
await mockChatSocket(page)
let fail = true
await page.route('**/sessions/conversations/restored-chat/messages/paginated?*', async route => {
await route.fulfill(fail
? { status: 503, json: { error: 'temporarily unavailable' } }
: { json: { session, messages: [{ id: 1, role: 'user', content: 'History recovered by retry', timestamp: 1000 }], total: 1, hasMore: false } })
})
await page.goto('/#/hermes/chat')
await expect(page.getByRole('alert')).toContainText('Could not load this conversation', { timeout: 12000 })
fail = false
await page.getByRole('alert').getByRole('button', { name: 'Retry' }).click()
await expect(page.getByText('History recovered by retry', { exact: true })).toBeVisible({ timeout: 12000 })
await expect(page.getByRole('alert')).toHaveCount(0)
})