Skip to content

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

test: refresh frontend fixtures for current UI contracts

Steven Enamakele69d793c65d3
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..a2e37e8373 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,8 @@ function selectWithin(node: Node, text: string) {
rangeCount: 1,
toString: () => text,
getRangeAt: () => ({
+ commonAncestorContainer: node,
+ intersectsNode: (candidate: Node) => candidate.contains(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..e42f9a0ae6 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([
+ ['Approve', 'approve_once'],
+ ['Always allow', 'approve_always_for_flow'],
+ ['Deny', 'deny'],
+ ] as const)('routes %s to the hook with the request id', (label, decision) => {
const decide = vi.fn().mockResolvedValue(undefined);
useFlowRunPoller.mockReturnValue({
run: makeRun({ status: 'pending_approval' }),
@@ -287,15 +291,10 @@ describe('FlowRunInspectorDrawer', () => {
decide,
});
renderDrawer('thread-1', vi.fn());
+ const card = within(screen.getByTestId('flow-run-pending-approval-req-a'));
- 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');
+ fireEvent.click(card.getByRole('button', { name: label }));
+ 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..161b3cfdbc 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 { describe, expect, it, vi } from 'vitest';
import type { SubagentActivity } from '../../../store/chatRuntimeSlice';
import { SubagentTaskCard } from './SubagentTaskCard';
+// The nested transcript's MessagePrimitive needs a ThreadPrimitive.Viewport.
+// These tests exercise the card and its reply actions without mounting a thread.
+vi.mock('../../../components/assistant-ui/elements/task-card.aui', () => ({
+ TaskTranscript: () => <div>Nested transcript</div>,
+}));
+
const activity: SubagentActivity = {
taskId: 'sub-1',
agentId: 'researcher',
diff --git a/app/src/providers/__tests__/liveHistoryParity.test.tsx b/app/src/providers/__tests__/liveHistoryParity.test.tsx
index 1aa36ddc56..6043375102 100644
--- a/app/src/providers/__tests__/liveHistoryParity.test.tsx
+++ b/app/src/providers/__tests__/liveHistoryParity.test.tsx
@@ -67,7 +67,11 @@ 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() }));