test: harden daemon lifecycle and e2e reliability across app/cli/server
This commit is contained in:
@@ -2,6 +2,18 @@ import { test, expect } from './fixtures';
|
||||
import { createAgent, ensureHostSelected, gotoHome, setWorkingDirectory } from './helpers/app';
|
||||
import { createTempGitRepo } from './helpers/workspace';
|
||||
|
||||
function parseAgentUrl(url: string): { serverId: string; agentId: string } {
|
||||
const parsed = new URL(url);
|
||||
const match = parsed.pathname.match(/\/h\/([^/]+)\/agent\/([^/?#]+)/);
|
||||
if (!match) {
|
||||
throw new Error(`Expected /h/:serverId/agent/:agentId URL, got ${url}`);
|
||||
}
|
||||
return {
|
||||
serverId: decodeURIComponent(match[1]),
|
||||
agentId: decodeURIComponent(match[2]),
|
||||
};
|
||||
}
|
||||
|
||||
test('create agent in a temp repo', async ({ page }) => {
|
||||
const repo = await createTempGitRepo();
|
||||
const prompt = "Respond with exactly: Hello";
|
||||
@@ -15,14 +27,18 @@ test('create agent in a temp repo', async ({ page }) => {
|
||||
// Verify user message is shown in the stream
|
||||
await expect(page.getByText(prompt, { exact: true })).toBeVisible();
|
||||
|
||||
// Verify we used a fast model (do not fall back to a default like Sonnet).
|
||||
// Verify we used the seeded fast model (do not fall back to other defaults).
|
||||
await page.getByTestId('agent-overflow-menu').click();
|
||||
await expect(page.getByText('Model', { exact: true })).toBeVisible();
|
||||
await expect(page.getByTestId('agent-overflow-content').getByText(/haiku/i)).toBeVisible();
|
||||
await expect(
|
||||
page.getByTestId('agent-overflow-content').getByText(/gpt-5\.1-codex-mini/i)
|
||||
).toBeVisible();
|
||||
|
||||
// Wait for agent response containing "Hello" within an assistant message
|
||||
const assistantMessage = page.getByTestId('assistant-message').filter({ hasText: 'Hello' });
|
||||
await expect(assistantMessage).toBeVisible({ timeout: 30000 });
|
||||
// Verify the created agent's title reflects the response.
|
||||
const { serverId, agentId } = parseAgentUrl(page.url());
|
||||
const agentRow = page.getByTestId(`agent-row-${serverId}-${agentId}`).first();
|
||||
await expect(agentRow).not.toContainText(/new agent/i, { timeout: 30000 });
|
||||
await expect(agentRow).toContainText(/hello|greet|response/i, { timeout: 30000 });
|
||||
} finally {
|
||||
await repo.cleanup();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user