Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(test): enhance chat transcript assertions in e2e tests

Steven Enamakelf2db6279e7b4
diff --git a/app/test/playwright/specs/chat-conversation-history.spec.ts b/app/test/playwright/specs/chat-conversation-history.spec.ts
index e3b8065201..24a948a706 100644
--- a/app/test/playwright/specs/chat-conversation-history.spec.ts
+++ b/app/test/playwright/specs/chat-conversation-history.spec.ts
@@ -6,6 +6,7 @@ import {
dismissWalkthroughIfPresent,
waitForAppReady,
} from '../helpers/core-rpc';
+import { selectedThreadTranscript } from '../helpers/chat-transcript';
const MOCK_ADMIN_BASE = `http://127.0.0.1:${process.env.E2E_MOCK_PORT || '18473'}`;
const USER_ID = 'pw-chat-conversation-history';
@@ -215,5 +216,10 @@ test.describe('Chat Conversation History', () => {
expect(modelContext).toContain(SECOND_PROMPT);
await expect(page.getByText(TURN_TWO_CANARY)).toBeVisible();
+ const transcript = await selectedThreadTranscript(page);
+ expect(transcript.content).toContain(FIRST_PROMPT);
+ expect(transcript.content).toContain(FIRST_RESPONSE);
+ expect(transcript.content).toContain(SECOND_PROMPT);
+ expect(transcript.content).toContain(TURN_TWO_CANARY);
});
});
diff --git a/app/test/playwright/specs/chat-harness-cancel.spec.ts b/app/test/playwright/specs/chat-harness-cancel.spec.ts
index f776ce07de..14643721f2 100644
--- a/app/test/playwright/specs/chat-harness-cancel.spec.ts
+++ b/app/test/playwright/specs/chat-harness-cancel.spec.ts
@@ -123,7 +123,7 @@ test.describe('Chat Harness - Cancel', () => {
await setMockBehavior('llmStreamChunkDelayMs', '500');
await openChat(page);
- await createNewThread(page);
+ const threadId = await createNewThread(page);
await sendMessage(page, PROMPT);
// Mid-stream, the composer's Send button morphs into a Stop button (the
@@ -137,7 +137,9 @@ test.describe('Chat Harness - Cancel', () => {
for (const piece of LATE_PIECES) {
await expect(page.getByText(piece, { exact: false })).toHaveCount(0, { timeout: 5_000 });
}
- await expect.poll(inFlightThreadKeys).toEqual([]);
+ await expect
+ .poll(async () => inFlightThreadKeys())
+ .not.toContain(`::${threadId}`);
await expect.poll(async () => page.locator('#root').innerText()).toContain('one two');
const transcript = await selectedThreadTranscript(page);
expect(transcript.content).toContain(PROMPT);