Skip to content

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

fix(flows): correct test for FlowRunInspectorDrawer

Steven Enamakelefa6bdb91383
diff --git a/app/src/components/flows/__tests__/FlowRunInspectorDrawer.test.tsx b/app/src/components/flows/__tests__/FlowRunInspectorDrawer.test.tsx
index f8c5689f3c..abbb06e242 100644
--- a/app/src/components/flows/__tests__/FlowRunInspectorDrawer.test.tsx
+++ b/app/src/components/flows/__tests__/FlowRunInspectorDrawer.test.tsx
@@ -392,4 +392,50 @@ describe('FlowRunInspectorDrawer', () => {
expect.objectContaining({ flowId: 'flow-42', runId: 'run-9', error: 'HTTP 500' })
);
});
+
+ // ── `variant="panel"` (host side panel, no overlay/backdrop/Escape) ───────
+ describe('variant="panel"', () => {
+ function renderPanel(runId: string | null, onClose: () => void) {
+ return render(
+ <Provider store={store}>
+ <FlowRunInspectorDrawer runId={runId} onClose={onClose} variant="panel" />
+ </Provider>
+ );
+ }
+
+ it('renders inline as flow-run-inspector-panel instead of the drawer/backdrop', () => {
+ useFlowRunPoller.mockReturnValue({ run: makeRun(), loading: false, error: null });
+ renderPanel('thread-1', vi.fn());
+
+ expect(screen.getByTestId('flow-run-inspector-panel')).toBeInTheDocument();
+ expect(screen.queryByTestId('flow-run-inspector-drawer')).not.toBeInTheDocument();
+ expect(screen.queryByTestId('flow-run-inspector-backdrop')).not.toBeInTheDocument();
+ // The same content still renders (header, steps, etc).
+ expect(screen.getByTestId('flow-run-status-pill')).toBeInTheDocument();
+ });
+
+ it('does not close on Escape in panel mode', () => {
+ useFlowRunPoller.mockReturnValue({ run: makeRun(), loading: false, error: null });
+ const onClose = vi.fn();
+ renderPanel('thread-1', onClose);
+
+ fireEvent.keyDown(document, { key: 'Escape' });
+ expect(onClose).not.toHaveBeenCalled();
+ });
+
+ it('still calls onClose via its own close button', () => {
+ useFlowRunPoller.mockReturnValue({ run: makeRun(), loading: false, error: null });
+ const onClose = vi.fn();
+ renderPanel('thread-1', onClose);
+
+ fireEvent.click(screen.getByTestId('flow-run-inspector-close'));
+ expect(onClose).toHaveBeenCalledTimes(1);
+ });
+
+ it('renders null when runId is null, same as drawer mode', () => {
+ useFlowRunPoller.mockReturnValue({ run: null, loading: false, error: null });
+ const { container } = renderPanel(null, vi.fn());
+ expect(container).toBeEmptyDOMElement();
+ });
+ });
});