Skip to content

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

test(playwright): add chat scroll stability and tool error recovery specs

Steven Enamakel2ccac7744ea0
diff --git a/app/test/playwright/specs/chat-scroll-stability.spec.ts b/app/test/playwright/specs/chat-scroll-stability.spec.ts
index 5efb464936..6da83bf29a 100644
--- a/app/test/playwright/specs/chat-scroll-stability.spec.ts
+++ b/app/test/playwright/specs/chat-scroll-stability.spec.ts
@@ -68,6 +68,24 @@ test.describe('Chat scroll paint stability', () => {
'[data-slot="aui_assistant-message-root"], [data-slot="aui_user-message-root"]'
);
await expect(roots).toHaveCount(TURN_COUNT * 2, { timeout: 20_000 });
+ await expect
+ .poll(() =>
+ page.evaluate(currentThreadId => {
+ const store = (
+ window as unknown as {
+ __OPENHUMAN_STORE__?: {
+ getState?: () => {
+ thread?: { selectedThreadId?: string | null; isLoadingMessages?: boolean };
+ };
+ };
+ }
+ ).__OPENHUMAN_STORE__;
+ const thread = store?.getState?.().thread;
+ return thread?.selectedThreadId === currentThreadId && !thread.isLoadingMessages;
+ }, threadId)
+ )
+ .toBe(true);
+ await page.waitForLoadState('networkidle');
expect(
await roots.evaluateAll(elements =>
elements.every(
diff --git a/app/test/playwright/specs/chat-tool-error-recovery.spec.ts b/app/test/playwright/specs/chat-tool-error-recovery.spec.ts
index 51292ae3f8..dae45cd9b2 100644
--- a/app/test/playwright/specs/chat-tool-error-recovery.spec.ts
+++ b/app/test/playwright/specs/chat-tool-error-recovery.spec.ts
@@ -130,6 +130,10 @@ test.describe('Chat Tool Error Recovery', () => {
const threadId = await createNewThread(page);
await sendMessage(page, 'Tell me something important.');
+ // A new thread starts with a null lifecycle too. Waiting only for null can
+ // therefore race ahead of the first turn and let the retry overlap it.
+ // The error card proves the failed turn actually ran before we retry.
+ await expect(page.getByText('Something went wrong')).toBeVisible({ timeout: 30_000 });
await expect
.poll(async () => {
const lifecycle = await page.evaluate(currentThreadId => {