From 338548bf7f612f8eeb655894e9c69aa5ab747c1f Mon Sep 17 00:00:00 2001 From: Maurice Date: Fri, 23 Oct 2026 20:10:07 +0200 Subject: [PATCH] test(studio): the assistant panel waits for its lazy chat as long as a busy runner needs The chat is a lazy chunk that grew with the kept notes and the place picker; findBy's default second ran out on the CI shard, so the welcome was never found. The waits for it get ten seconds, under the fifteen second test limit. --- .../Studio/StudioAssistantPanel.test.tsx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/client/src/components/Studio/StudioAssistantPanel.test.tsx b/client/src/components/Studio/StudioAssistantPanel.test.tsx index 42c8dcc48..95c4f2b36 100644 --- a/client/src/components/Studio/StudioAssistantPanel.test.tsx +++ b/client/src/components/Studio/StudioAssistantPanel.test.tsx @@ -22,6 +22,8 @@ import { chatOf, useAssistantStore } from '../../store/assistantStore'; import StudioAssistantPanel, { StudioAssistantColumn, StudioAssistantToggle } from './StudioAssistantPanel'; import type { StudioAssistant } from './useStudioAssistant'; +/** The assistant's surface is loaded lazily, which can outlast findBy's default second on CI. */ +const LAZY = { timeout: 10_000 }; const JOURNEY = 12; const KEY = assistantChatKey({ kind: 'journey', journeyId: JOURNEY }); const INITIAL = useAssistantStore.getState(); @@ -75,7 +77,8 @@ describe('StudioAssistantPanel', () => { render(); expect(screen.getByRole('complementary', { name: 'Book assistant' })).toBeInTheDocument(); - expect(await screen.findByText('What should the book look like?')).toBeInTheDocument(); + // The chat is a lazy chunk; on a busy runner it can take longer than findBy's default second. + expect(await screen.findByText('What should the book look like?', undefined, LAZY)).toBeInTheDocument(); const notice = screen.getByRole('note'); expect(notice.textContent).toContain('Only that page goes to Anthropic'); @@ -97,7 +100,8 @@ describe('StudioAssistantPanel', () => { useAssistantStore.setState({ status: { ...STATUS, studioImagesAcked: true } }); render(); - expect(await screen.findByText('What should the book look like?')).toBeInTheDocument(); + // The chat is a lazy chunk; on a busy runner it can take longer than findBy's default second. + expect(await screen.findByText('What should the book look like?', undefined, LAZY)).toBeInTheDocument(); expect(screen.queryByRole('note')).toBeNull(); }); @@ -144,7 +148,8 @@ describe('StudioAssistantPanel', () => { it('FE-STUDIO-ASTPANEL-005: the journey chat offers no trip notes, which only a trip turn reads', async () => { render(); - expect(await screen.findByText('What should the book look like?')).toBeInTheDocument(); + // The chat is a lazy chunk; on a busy runner it can take longer than findBy's default second. + expect(await screen.findByText('What should the book look like?', undefined, LAZY)).toBeInTheDocument(); expect(screen.getByRole('button', { name: 'Recent chats' })).toBeInTheDocument(); expect(screen.queryByRole('button', { name: 'Trip notes' })).toBeNull(); }); @@ -175,7 +180,8 @@ describe('StudioAssistantPanel', () => { }); render(); - expect(await screen.findByText('What should the book look like?')).toBeInTheDocument(); + // The chat is a lazy chunk; on a busy runner it can take longer than findBy's default second. + expect(await screen.findByText('What should the book look like?', undefined, LAZY)).toBeInTheDocument(); expect(screen.queryByRole('note')).toBeNull(); expect(screen.queryByRole('button', { name: 'Show it pages' })).toBeNull(); }); @@ -207,7 +213,8 @@ describe('StudioAssistantPanel', () => { render(); expect(screen.getByRole('complementary', { name: 'Book assistant' })).toBeInTheDocument(); - expect(await screen.findByText('What should the book look like?')).toBeInTheDocument(); + // The chat is a lazy chunk; on a busy runner it can take longer than findBy's default second. + expect(await screen.findByText('What should the book look like?', undefined, LAZY)).toBeInTheDocument(); expect(screen.getByRole('heading', { name: 'Journey' })).toBeInTheDocument(); }); });