Skip to content

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

test(playwright): assert tool calls via rendered UI

Steven Enamakel37bc8a7eae8a
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 c581852e7e..a0a06ea676 100644
--- a/app/test/playwright/specs/chat-multi-tool-round.spec.ts
+++ b/app/test/playwright/specs/chat-multi-tool-round.spec.ts
@@ -130,22 +130,6 @@ async function sendMessage(page: Page, prompt: string): Promise<void> {
await page.getByTestId('send-message-button').click();
}
-async function toolTimelineNames(page: Page, threadId: string): Promise<string[]> {
- return page.evaluate(currentThreadId => {
- const store = (
- window as unknown as {
- __OPENHUMAN_STORE__?: {
- getState?: () => {
- chatRuntime?: { toolTimelineByThread?: Record<string, Array<{ name?: string }>> };
- };
- };
- }
- ).__OPENHUMAN_STORE__;
- const entries = store?.getState?.().chatRuntime?.toolTimelineByThread?.[currentThreadId] ?? [];
- return entries.map(entry => entry.name ?? '');
- }, threadId);
-}
-
test.describe('Chat Multi Tool Round', () => {
test('runs file_read then grep before the final answer', async ({ page }) => {
await resetMock();
@@ -157,14 +141,14 @@ test.describe('Chat Multi Tool Round', () => {
await sendMessage(page, PROMPT);
await expect(agentMessageText(page, CANARY_FINAL)).toBeVisible({ timeout: 50_000 });
- await expect
- .poll(async () => toolTimelineNames(page, threadId), { timeout: 20_000 })
- .toEqual(expect.arrayContaining([expect.stringContaining('web_fetch'), expect.stringContaining('web_search')]));
-
- const names = await toolTimelineNames(page, threadId);
- const fetchIndex = names.findIndex(name => name.includes('web_fetch'));
- const searchIndex = names.findIndex(name => name.includes('web_search'));
+ const cards = page.getByTestId('assistant-ui-tool-call');
+ await expect(cards.filter({ hasText: 'Fetching example.com' })).toHaveCount(1);
+ await expect(cards.filter({ hasText: 'Searching the web' })).toHaveCount(1);
+ const renderedCards = await cards.allTextContents();
+ const fetchIndex = renderedCards.findIndex(text => text.includes('Fetching example.com'));
+ const searchIndex = renderedCards.findIndex(text => text.includes('Searching the web'));
expect(fetchIndex).toBeGreaterThanOrEqual(0);
expect(searchIndex).toBeGreaterThan(fetchIndex);
+ 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 fcdfbbd102..efb4772b7a 100644
--- a/app/test/playwright/specs/chat-tool-call-flow.spec.ts
+++ b/app/test/playwright/specs/chat-tool-call-flow.spec.ts
@@ -122,22 +122,6 @@ async function sendMessage(page: Page, prompt: string): Promise<void> {
await page.getByTestId('send-message-button').click();
}
-async function toolTimelineNames(page: Page, threadId: string): Promise<string[]> {
- return page.evaluate(currentThreadId => {
- const store = (
- window as unknown as {
- __OPENHUMAN_STORE__?: {
- getState?: () => {
- chatRuntime?: { toolTimelineByThread?: Record<string, Array<{ name?: string }>> };
- };
- };
- }
- ).__OPENHUMAN_STORE__;
- const entries = store?.getState?.().chatRuntime?.toolTimelineByThread?.[currentThreadId] ?? [];
- return entries.map(entry => entry.name ?? '');
- }, threadId);
-}
-
test.describe('Chat Tool Call Flow', () => {
test('renders a terminal tool call, final answer, and clears in-flight state', async ({
page,
@@ -178,10 +162,6 @@ test.describe('Chat Tool Call Flow', () => {
if ((await toolTrigger.getAttribute('aria-expanded')) !== 'true') await toolTrigger.click();
await expect(toolCard.getByText('Input', { exact: true })).toBeVisible();
- await expect
- .poll(async () => toolTimelineNames(page, threadId), { timeout: 20_000 })
- .toEqual(expect.arrayContaining([expect.stringContaining('web_fetch')]));
-
expect(threadId.length).toBeGreaterThan(0);
});
});
diff --git a/app/test/playwright/specs/gmail-flow.spec.ts b/app/test/playwright/specs/gmail-flow.spec.ts
index a09113477c..521016282c 100644
--- a/app/test/playwright/specs/gmail-flow.spec.ts
+++ b/app/test/playwright/specs/gmail-flow.spec.ts
@@ -2,7 +2,6 @@ import { expect, type Page, test } from '@playwright/test';
import {
bootRuntimeReadyGuestPage,
- callCoreRpc,
dismissWalkthroughIfPresent,
signInViaBypassUser,
waitForAppReady,
@@ -11,11 +10,8 @@ import {
const CONNECTOR_NAME = 'Gmail';
const TOOLKIT_SLUG = 'gmail';
const CONNECTION_ID = 'c-gmail-1';
-const ACTION = 'GMAIL_FETCH_EMAILS';
const MOCK_BASE = 'http://127.0.0.1:' + (process.env.E2E_MOCK_PORT || '18473');
-type RequestLogEntry = { method?: string; url?: string; body?: string };
-
async function mockFetch(path: string, init?: RequestInit) {
const response = await fetch(MOCK_BASE + path, init);
if (!response.ok) throw new Error('mock request failed: ' + response.status + ' ' + path);
@@ -38,11 +34,6 @@ async function setMockBehavior(behavior: Record<string, unknown>) {
});
}
-async function getRequestLog(): Promise<RequestLogEntry[]> {
- const payload = await mockFetch('/__admin/requests');
- return (payload.data as RequestLogEntry[]) ?? [];
-}
-
async function seedConnector(status: 'ACTIVE' | 'FAILED' | 'EXPIRED' = 'ACTIVE') {
await setMockBehavior({
composioToolkits: JSON.stringify([TOOLKIT_SLUG]),
@@ -113,6 +104,19 @@ test.describe('Gmail Integration Flows', () => {
await expect(dialog.getByTestId('trigger-toggles')).toBeVisible();
});
+ test('disconnects Gmail from the current Composio management screen', async ({ page }) => {
+ const dialog = await openModal(page);
+ await expect(dialog).toContainText('Gmail is connected');
+
+ await dialog.getByRole('button', { name: 'Disconnect', exact: true }).click();
+
+ await expect(dialog.getByRole('button', { name: 'Connect Gmail', exact: true })).toBeVisible({
+ timeout: 15_000,
+ });
+ await expect(dialog).not.toContainText('Gmail is connected');
+ await expect(page.getByTestId('skill-install-composio-gmail')).toContainText(/Connect/i);
+ });
+
test('failed and expired states remain usable', async ({ page }) => {
await seedConnector('FAILED');
await page.reload();