Skip to content

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

test(e2e): expand activity groups before asserting tool cards

Steven Enamakeld589b869f907
diff --git a/app/test/e2e/specs/chat-tool-call-flow.spec.ts b/app/test/e2e/specs/chat-tool-call-flow.spec.ts
index b88eb03e0d..74c565134b 100644
--- a/app/test/e2e/specs/chat-tool-call-flow.spec.ts
+++ b/app/test/e2e/specs/chat-tool-call-flow.spec.ts
@@ -17,7 +17,7 @@ import {
typeIntoComposer,
waitForSocketConnected,
} from '../helpers/chat-harness';
-import { textExists } from '../helpers/element-helpers';
+import { clickToolGroupTrigger, textExists } from '../helpers/element-helpers';
import { resetApp } from '../helpers/reset-app';
import { navigateViaHash } from '../helpers/shared-flows';
import { clearRequestLog, setMockBehavior, startMockServer, stopMockServer } from '../mock-server';
@@ -51,6 +51,15 @@ async function renderedToolCards(): Promise<string[]> {
)) as string[];
}
+async function activityGroupExpanded(): Promise<boolean> {
+ return browser.execute(() => {
+ const trigger = document.querySelector<HTMLElement>(
+ '[data-slot="tool-group-root"] [data-slot="tool-group-trigger"]'
+ );
+ return trigger?.getAttribute('aria-expanded') === 'true';
+ });
+}
+
describe('Chat tool-call lifecycle', () => {
before(async () => {
console.log(`${LOG_PREFIX} Starting mock server and resetting app`);
@@ -108,9 +117,28 @@ describe('Chat tool-call lifecycle', () => {
it('T1.2 — rendered assistant UI tool card identifies the web fetch', async () => {
console.log(`${LOG_PREFIX} T1.2: checking rendered tool card`);
- const cards = await renderedToolCards();
- expect(cards.some(card => card.includes('Fetching example.com'))).toBe(true);
- expect(await textExists('Fetching example.com')).toBe(true);
+ await browser.waitUntil(async () => await textExists(CANARY_FINAL), {
+ timeout: 40_000,
+ timeoutMsg: 'final answer did not render before inspecting the settled tool timeline',
+ });
+ if (!(await activityGroupExpanded())) {
+ await clickToolGroupTrigger(0, '1 tool call');
+ }
+ await browser.waitUntil(async () => await activityGroupExpanded(), {
+ timeout: 10_000,
+ timeoutMsg: 'assistant activity group did not expand to show the rendered tool card',
+ });
+ const cards = await browser.execute(() =>
+ Array.from(
+ document.querySelectorAll<HTMLElement>(
+ '[data-slot="tool-group-root"] [data-testid="assistant-ui-tool-call"]'
+ )
+ ).map(card => ({ name: card.getAttribute('data-tool-name'), text: card.innerText }))
+ );
+ expect(cards).toHaveLength(1);
+ expect(cards[0].name).toBe('web_fetch');
+ expect(cards[0].text).toContain('Read webpage');
+ expect(cards[0].text).toContain('example.com');
});
it('T1.3 — final answer with canary text renders in the DOM', async () => {
diff --git a/app/test/playwright/specs/chat-multi-tool-round.spec.ts b/app/test/playwright/specs/chat-multi-tool-round.spec.ts
index f7a478ca61..66e153172d 100644
--- a/app/test/playwright/specs/chat-multi-tool-round.spec.ts
+++ b/app/test/playwright/specs/chat-multi-tool-round.spec.ts
@@ -130,6 +130,15 @@ async function sendMessage(page: Page, prompt: string): Promise<void> {
await page.getByTestId('send-message-button').click();
}
+async function openLatestActivityGroup(page: Page) {
+ const group = page.locator('[data-slot="tool-group-root"]').last();
+ await expect(group).toBeVisible({ timeout: 30_000 });
+ const trigger = group.locator('[data-slot="tool-group-trigger"]');
+ if ((await trigger.getAttribute('aria-expanded')) !== 'true') await trigger.click();
+ await expect(trigger).toHaveAttribute('aria-expanded', 'true');
+ return group;
+}
+
test.describe('Chat Multi Tool Round', () => {
test('runs file_read then grep before the final answer', async ({ page }) => {
await resetMock();
@@ -141,14 +150,14 @@ test.describe('Chat Multi Tool Round', () => {
await sendMessage(page, PROMPT);
await expect(agentMessageText(page, CANARY_FINAL)).toBeVisible({ timeout: 50_000 });
- const cards = page.getByTestId('assistant-ui-tool-call');
- await expect(cards.filter({ hasText: 'Fetching example.com' })).toHaveCount(1);
- await expect(cards.filter({ hasText: /Search(?:ing|ed) the web/ })).toHaveCount(1);
- const renderedCards = await cards.allTextContents();
- const fetchIndex = renderedCards.findIndex(text => text.includes('Fetching example.com'));
- const searchIndex = renderedCards.findIndex(text => /Search(?:ing|ed) the web/.test(text));
- expect(fetchIndex).toBeGreaterThanOrEqual(0);
- expect(searchIndex).toBeGreaterThan(fetchIndex);
+ const activityGroup = await openLatestActivityGroup(page);
+ const cards = activityGroup.getByTestId('assistant-ui-tool-call');
+ await expect(cards).toHaveCount(2);
+ await expect(cards.nth(0)).toHaveAttribute('data-tool-name', 'web_fetch');
+ await expect(cards.nth(1)).toHaveAttribute('data-tool-name', 'web_search_tool');
+ await expect(cards.nth(0)).toContainText('Read webpage');
+ await expect(cards.nth(0)).toContainText('example.com');
+ await expect(cards.nth(1)).toContainText(/Search(?:ing|ed) the web/);
await expect(agentMessageText(page, CANARY_FINAL)).toBeVisible();
});
});
diff --git a/app/test/playwright/specs/chat-tool-call-flow.spec.ts b/app/test/playwright/specs/chat-tool-call-flow.spec.ts
index efb4772b7a..5d1d396dc0 100644
--- a/app/test/playwright/specs/chat-tool-call-flow.spec.ts
+++ b/app/test/playwright/specs/chat-tool-call-flow.spec.ts
@@ -122,6 +122,15 @@ async function sendMessage(page: Page, prompt: string): Promise<void> {
await page.getByTestId('send-message-button').click();
}
+async function openLatestActivityGroup(page: Page) {
+ const group = page.locator('[data-slot="tool-group-root"]').last();
+ await expect(group).toBeVisible({ timeout: 30_000 });
+ const trigger = group.locator('[data-slot="tool-group-trigger"]');
+ if ((await trigger.getAttribute('aria-expanded')) !== 'true') await trigger.click();
+ await expect(trigger).toHaveAttribute('aria-expanded', 'true');
+ return group;
+}
+
test.describe('Chat Tool Call Flow', () => {
test('renders a terminal tool call, final answer, and clears in-flight state', async ({
page,
@@ -148,10 +157,14 @@ test.describe('Chat Tool Call Flow', () => {
// Tool activity belongs to assistant-ui and renders as a readable card,
// never through the removed legacy Agentic task insights timeline.
await expect(page.getByTestId('agent-task-insights')).toHaveCount(0);
- await expect(page.getByTestId('assistant-ui-tool-call')).toHaveCount(1);
- const toolCard = page.getByTestId('assistant-ui-tool-call');
+ const activityGroup = await openLatestActivityGroup(page);
+ const toolCard = activityGroup.locator(
+ '[data-testid="assistant-ui-tool-call"][data-tool-name="web_fetch"]'
+ );
+ await expect(toolCard).toHaveCount(1);
await expect(toolCard).toBeVisible();
- await expect(toolCard).toContainText('Fetching example.com');
+ await expect(toolCard).toContainText('Read webpage');
+ await expect(toolCard).toContainText('example.com');
// Web-channel turns retain supervised access even if the stored config is
// wider. The external fetch is therefore cancelled without an approval
// surface, and must render its actual terminal state instead of a false
diff --git a/app/test/playwright/specs/gmail-flow.spec.ts b/app/test/playwright/specs/gmail-flow.spec.ts
index 521016282c..46f3166527 100644
--- a/app/test/playwright/specs/gmail-flow.spec.ts
+++ b/app/test/playwright/specs/gmail-flow.spec.ts
@@ -114,7 +114,9 @@ test.describe('Gmail Integration Flows', () => {
timeout: 15_000,
});
await expect(dialog).not.toContainText('Gmail is connected');
- await expect(page.getByTestId('skill-install-composio-gmail')).toContainText(/Connect/i);
+ await expect(page.getByTestId('skill-install-composio-gmail')).toHaveAccessibleName(
+ /Gmail,.*Connect\./i
+ );
});
test('failed and expired states remain usable', async ({ page }) => {