Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

test: wait for plan data before asserting LoomProductionPanel summary (#12880)

Adam Eivy4a98c7d75964
diff --git a/client/src/components/fableloom/LoomProductionPanel.test.jsx b/client/src/components/fableloom/LoomProductionPanel.test.jsx
index 2505d9f62c..78a8428584 100644
--- a/client/src/components/fableloom/LoomProductionPanel.test.jsx
+++ b/client/src/components/fableloom/LoomProductionPanel.test.jsx
@@ -1,5 +1,5 @@
import { beforeEach, describe, expect, it, vi } from 'vitest';
-import { act, fireEvent, render, screen, waitFor } from '@testing-library/react';
+import { act, fireEvent, render, screen, waitFor, within } from '@testing-library/react';
import LoomProductionPanel from './LoomProductionPanel';
import * as api from '../../services/api';
import socket from '../../services/socket';
@@ -92,12 +92,12 @@ describe('LoomProductionPanel', () => {
it('renders plan summary and allows switching mode', async () => {
render(<LoomProductionPanel loom={sampleLoom} episode={sampleEpisode} onSelectNode={vi.fn()} />);
- await waitFor(() => {
- expect(screen.getByText('Episodic Production Plan')).toBeInTheDocument();
- });
+ expect(await screen.findByText('Episodic Production Plan')).toBeInTheDocument();
- expect(screen.getByText('3')).toBeInTheDocument(); // storyboard images only by default
- expect(screen.getByText('Generate Storyboard Images')).toBeInTheDocument();
+ // The summary cards render only once the plan response lands, which can trail the heading.
+ const plannedCard = (await screen.findByText('Planned Assets')).parentElement;
+ expect(within(plannedCard).getByText('3')).toBeInTheDocument(); // storyboard images only by default
+ expect(await screen.findByText('Generate Storyboard Images')).toBeInTheDocument();
const modeSelect = screen.getByLabelText('Mode:');
fireEvent.change(modeSelect, { target: { value: 'exact_inputs' } });