mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-27 17:58:07 +00:00
test(desktop): wait for committed compress directive
This commit is contained in:
parent
cff60b205d
commit
76e416052c
1 changed files with 11 additions and 13 deletions
|
|
@ -4,11 +4,7 @@
|
|||
|
||||
import { expect, test, type Page } from '@playwright/test'
|
||||
|
||||
import {
|
||||
type MockBackendFixture,
|
||||
setupMockBackend,
|
||||
waitForAppReady,
|
||||
} from './fixtures'
|
||||
import { type MockBackendFixture, setupMockBackend, waitForAppReady } from './fixtures'
|
||||
import { MOCK_REPLY, receivedUserTexts, restartMockServer } from './mock-server'
|
||||
|
||||
async function send(page: Page, text: string, delay = 15): Promise<void> {
|
||||
|
|
@ -25,12 +21,11 @@ async function pasteAndSend(page: Page, text: string): Promise<void> {
|
|||
await page.keyboard.press('Enter')
|
||||
}
|
||||
|
||||
|
||||
async function waitForTranscript(page: Page, text: string, timeout = 90_000): Promise<void> {
|
||||
await page.waitForFunction(
|
||||
expected => document.querySelector('[data-slot="aui_thread-viewport"]')?.textContent?.includes(expected) ?? false,
|
||||
text,
|
||||
{ timeout },
|
||||
{ timeout }
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -70,15 +65,18 @@ test.describe('session compression', () => {
|
|||
const composer = page.locator('[contenteditable="true"]').first()
|
||||
await composer.click()
|
||||
await composer.type('/compress', { delay: 15 })
|
||||
await page.getByText('/compress').first().waitFor({ state: 'visible' })
|
||||
const compressionCompletion = page
|
||||
.locator('[data-slot="composer-completion-drawer"][role="listbox"]')
|
||||
.getByRole('button', { name: /^\/compress\b/ })
|
||||
await expect(compressionCompletion).toBeVisible()
|
||||
await compressionCompletion.hover()
|
||||
await expect(compressionCompletion).toHaveAttribute('data-highlighted', '')
|
||||
await page.keyboard.press('Enter')
|
||||
await expect(composer.locator('[data-slot="aui_slash-chip"][title="/compress"]')).toBeVisible()
|
||||
await composer.type(' preserve the three test turns', { delay: 15 })
|
||||
await page.keyboard.press('Enter')
|
||||
await expect
|
||||
.poll(
|
||||
() => page.locator('[data-slot="aui_thread-viewport"]').textContent(),
|
||||
{ timeout: 90_000 },
|
||||
)
|
||||
.poll(() => page.locator('[data-slot="aui_thread-viewport"]').textContent(), { timeout: 90_000 })
|
||||
.toMatch(/Compressed|No changes from compression/)
|
||||
|
||||
// Compression rotates the agent's live session id. A post-compression
|
||||
|
|
@ -105,7 +103,7 @@ auxiliary:
|
|||
provider: custom
|
||||
model: mock-model`,
|
||||
mockServer: {
|
||||
holdFirstCompletionContaining: 'You are a summarization agent creating a context checkpoint.',
|
||||
holdFirstCompletionContaining: 'You are a summarization agent creating a context checkpoint.'
|
||||
}
|
||||
})
|
||||
await waitForAppReady(fixture, 120_000)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue