From d8c34115d7214b61287e59c76842935d03cf11ba Mon Sep 17 00:00:00 2001 From: gamolong Date: Thu, 12 Nov 2026 17:58:00 +0800 Subject: [PATCH 1/3] test(desktop): wait for the sidebar's job list before focusing its job On a slow macOS runner the list could land a moment after the progress event, so the test read null and failed (seen on #282). --- desktop/src/renderer/app/workNow.test.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/desktop/src/renderer/app/workNow.test.tsx b/desktop/src/renderer/app/workNow.test.tsx index 6faec07e..41309f6e 100644 --- a/desktop/src/renderer/app/workNow.test.tsx +++ b/desktop/src/renderer/app/workNow.test.tsx @@ -174,7 +174,8 @@ describe('running jobs in the sidebar (§4.11)', () => { await screen.findByRole('heading', { name: 'React' }); const rebuilding = jobAt('rb', 'rebuild', { track: 'React', stage: 0, thinking: false }); act(() => tell(rebuilding)); - const job = within(working()!).getByRole('button'); + // The list can land a moment after the event on a slow runner: wait for it. + const job = within(await within(sidebar()).findByRole('list', { name: 'Codemm is working' })).getByRole('button'); act(() => job.focus()); expect(job).toHaveFocus(); act(() => tell({ ...rebuilding, ended: true })); From 9ee7d02a1ef07ec4de5937f3d937d44ff34f50c8 Mon Sep 17 00:00:00 2001 From: gamolong Date: Thu, 12 Nov 2026 18:10:44 +0800 Subject: [PATCH 2/3] test(desktop): wait for the sidebar's job names too, after a second flaky read on a loaded run --- desktop/src/renderer/app/workNow.test.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/desktop/src/renderer/app/workNow.test.tsx b/desktop/src/renderer/app/workNow.test.tsx index 41309f6e..e58b7d7a 100644 --- a/desktop/src/renderer/app/workNow.test.tsx +++ b/desktop/src/renderer/app/workNow.test.tsx @@ -99,17 +99,18 @@ describe('running jobs in the sidebar (§4.11)', () => { act(() => tell(jobAt('l1', 'lesson', { concept: TOPIC }))); act(() => tell(jobAt('a1', 'author', { concept: TOPIC, stage: 2, part: { done: 2, total: 3 } }))); act(() => tell(jobAt('r1', 'roadmap'))); - expect(names()).toEqual([ + // The list can land a moment after the events on a slow runner: wait for it. + await waitFor(() => expect(names()).toEqual([ 'Writing a lesson on JavaScript basics, Writing the lesson', 'Writing an activity on JavaScript basics, Checking the exercise, step 2 of 3', 'Changing the roadmap, Changing the roadmap', - ]); + ])); // A retry reads short; a job quiet for 90 seconds says it is still working; a finished job leaves. act(() => tell(jobAt('l1', 'lesson', { concept: TOPIC, retry: { attempt: 2, of: 3 } }))); act(() => tell(jobAt('a1', 'author', { concept: TOPIC, idleMs: 95_000 }))); act(() => tell({ ...jobAt('r1', 'roadmap'), ended: true })); - expect(names()).toEqual(['Writing a lesson on JavaScript basics, Taking a little longer', 'Writing an activity on JavaScript basics, Still working']); + await waitFor(() => expect(names()).toEqual(['Writing a lesson on JavaScript basics, Taking a little longer', 'Writing an activity on JavaScript basics, Still working'])); await user.click(within(working()!).getByRole('button', { name: /^Writing a lesson/ })); expect(await screen.findByRole('heading', { name: 'JavaScript basics' })).toBeInTheDocument(); From 00448bea1df34d8c80cc1f77786bb67d0e01a37f Mon Sep 17 00:00:00 2001 From: gamolong Date: Thu, 12 Nov 2026 18:20:15 +0800 Subject: [PATCH 3/3] test(desktop): give the IPC error smoke test's first window 30 seconds on a busy runner --- desktop/e2e/smoke.spec.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/desktop/e2e/smoke.spec.ts b/desktop/e2e/smoke.spec.ts index e603627c..26c20277 100644 --- a/desktop/e2e/smoke.spec.ts +++ b/desktop/e2e/smoke.spec.ts @@ -144,7 +144,8 @@ test('renderer security', async ({ launch }) => { // "Error invoking remote method" envelope, so codes like codemm:repair still match. test('errors cross IPC as their own message', async ({ launch }) => { const { app, page } = await launch(); - await expect(page.getByRole('button', { name: 'Connect an agent', exact: true })).toBeVisible(); + // A first window on a busy CI runner can take longer than the default 5 seconds. + await expect(page.getByRole('button', { name: 'Connect an agent', exact: true })).toBeVisible({ timeout: 30_000 }); const messages = await page.evaluate(async () => { const bridge = (window as unknown as { codemm: { invoke(m: string, a: unknown[]): Promise } }).codemm; const call = (method: string, args: unknown[]) => bridge.invoke(method, args).then(() => 'resolved', (e: Error) => e.message);