Skip to content

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

test: repair frontend baseline fixtures

Steven Enamakelf02012c0fcb4
diff --git a/app/src/components/assistant-ui/__tests__/thread.quote.test.tsx b/app/src/components/assistant-ui/__tests__/thread.quote.test.tsx
index b386b6dda5..27bb2309fa 100644
--- a/app/src/components/assistant-ui/__tests__/thread.quote.test.tsx
+++ b/app/src/components/assistant-ui/__tests__/thread.quote.test.tsx
@@ -58,6 +58,7 @@ function selectWithin(node: Node, text: string) {
rangeCount: 1,
toString: () => text,
getRangeAt: () => ({
+ commonAncestorContainer: node,
getBoundingClientRect: () => ({ top: 100, left: 40, width: 120, height: 18 }),
}),
removeAllRanges,
diff --git a/app/src/components/flows/__tests__/FlowRunInspectorDrawer.test.tsx b/app/src/components/flows/__tests__/FlowRunInspectorDrawer.test.tsx
index 464194a8b9..84c92f4f8f 100644
--- a/app/src/components/flows/__tests__/FlowRunInspectorDrawer.test.tsx
+++ b/app/src/components/flows/__tests__/FlowRunInspectorDrawer.test.tsx
@@ -12,7 +12,7 @@
* `hooks/__tests__/useFlowRunPoller.test.ts` and
* `hooks/__tests__/useFlowPendingApprovals.test.ts`.
*/
-import { fireEvent, render, screen } from '@testing-library/react';
+import { fireEvent, render, screen, within } from '@testing-library/react';
import { Provider } from 'react-redux';
import { beforeEach, describe, expect, it, vi } from 'vitest';
@@ -273,7 +273,11 @@ describe('FlowRunInspectorDrawer', () => {
expect(screen.queryByTestId('flow-run-pending-approvals')).not.toBeInTheDocument();
});
- it("routes Approve once / Approve always / Deny to the hook's decide() with the request id", () => {
+ it.each([
+ { button: 'Approve', decision: 'approve_once' },
+ { button: 'Always allow', decision: 'approve_always_for_flow' },
+ { button: 'Deny', decision: 'deny' },
+ ])('routes $button to the hook with the request id', ({ button, decision }) => {
const decide = vi.fn().mockResolvedValue(undefined);
useFlowRunPoller.mockReturnValue({
run: makeRun({ status: 'pending_approval' }),
@@ -288,14 +292,9 @@ describe('FlowRunInspectorDrawer', () => {
});
renderDrawer('thread-1', vi.fn());
- fireEvent.click(screen.getByTestId('flow-run-pending-approval-approve-req-a'));
- expect(decide).toHaveBeenCalledWith('req-a', 'approve_once');
-
- fireEvent.click(screen.getByTestId('flow-run-pending-approval-always-req-a'));
- expect(decide).toHaveBeenCalledWith('req-a', 'approve_always_for_flow');
-
- fireEvent.click(screen.getByTestId('flow-run-pending-approval-deny-req-a'));
- expect(decide).toHaveBeenCalledWith('req-a', 'deny');
+ const card = screen.getByTestId('flow-run-pending-approval-req-a');
+ fireEvent.click(within(card).getByRole('button', { name: button }));
+ expect(decide).toHaveBeenCalledWith('req-a', decision);
});
it('shows the polling error message when useFlowPendingApprovals reports one', () => {
diff --git a/app/src/features/conversations/aui/SubagentTaskCard.test.tsx b/app/src/features/conversations/aui/SubagentTaskCard.test.tsx
index 950a63fdea..f4497efb9a 100644
--- a/app/src/features/conversations/aui/SubagentTaskCard.test.tsx
+++ b/app/src/features/conversations/aui/SubagentTaskCard.test.tsx
@@ -1,9 +1,15 @@
-import { render, screen } from '@testing-library/react';
-import { describe, expect, it } from 'vitest';
+import { fireEvent, render, screen } from '@testing-library/react';
+import { describe, expect, it, vi } from 'vitest';
import type { SubagentActivity } from '../../../store/chatRuntimeSlice';
import { SubagentTaskCard } from './SubagentTaskCard';
+const append = vi.hoisted(() => vi.fn());
+vi.mock('@assistant-ui/react', async importActual => ({
+ ...(await importActual<typeof import('@assistant-ui/react')>()),
+ useAui: () => ({ thread: { append } }),
+}));
+
const activity: SubagentActivity = {
taskId: 'sub-1',
agentId: 'researcher',
@@ -79,6 +85,7 @@ describe('SubagentTaskCard', () => {
}
argsText="{}"
result={undefined}
+ messages={[]}
status={{ type: 'requires-action', reason: 'interrupt' }}
addResult={() => {}}
resume={() => {}}
@@ -88,5 +95,14 @@ describe('SubagentTaskCard', () => {
expect(screen.getByTestId('subagent-awaiting-user')).toBeInTheDocument();
expect(screen.getByTestId('subagent-awaiting-question')).toHaveTextContent('Which repo?');
+ fireEvent.change(screen.getByTestId('subagent-answer-input'), {
+ target: { value: 'OpenHuman' },
+ });
+ fireEvent.click(screen.getByTestId('subagent-answer-send'));
+ expect(append).toHaveBeenCalledWith({
+ role: 'user',
+ content: [{ type: 'text', text: 'OpenHuman' }],
+ });
+ expect(screen.getByTestId('subagent-answer-sent')).toBeInTheDocument();
});
});
diff --git a/app/src/providers/__tests__/liveHistoryParity.test.tsx b/app/src/providers/__tests__/liveHistoryParity.test.tsx
index 1aa36ddc56..1e595d6e45 100644
--- a/app/src/providers/__tests__/liveHistoryParity.test.tsx
+++ b/app/src/providers/__tests__/liveHistoryParity.test.tsx
@@ -67,7 +67,7 @@ vi.mock('../../services/api/threadApi', () => ({
}));
vi.mock('../../services/socketService', () => ({
- socketService: { subscribeThread: vi.fn(() => Promise.resolve(true)) },
+ socketService: { subscribeThread: vi.fn(() => Promise.resolve(true)), on: vi.fn(), off: vi.fn() },
}));
vi.mock('../../hooks/usageRefresh', () => ({ requestUsageRefresh: vi.fn() }));