From 0c495e2eed4b2034c1a8a6bbf86618151b0a8104 Mon Sep 17 00:00:00 2001 From: l0ng-ai Date: Sat, 5 Dec 2026 23:59:19 +0800 Subject: [PATCH] test: wait for idle parsing and an enabled Refresh in two timing-sensitive tests (#8262) The late-parse color gutter test waited the default second for a 4000-line parse that runs in idle time; it now waits up to 10 s. The SVN Incoming test clicked Refresh again while the button was still disabled from the previous read, so the second read never started; it now waits for Refresh to be enabled. --- src/features/color-preview/gutter.test.ts | 6 ++++-- src/features/vcs/__tests__/svnToolWindowParity.test.tsx | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/features/color-preview/gutter.test.ts b/src/features/color-preview/gutter.test.ts index b0f9e3cbb4..d4d93afdf1 100644 --- a/src/features/color-preview/gutter.test.ts +++ b/src/features/color-preview/gutter.test.ts @@ -173,8 +173,10 @@ it("shows a markup file's style colors once a parse that outlasted opening the e }); view.scrollDOM.style.height = "100px"; view.dispatch({ effects: EditorView.scrollIntoView(view.state.doc.length) }); - await vi.waitFor(() => - expect(view!.dom.querySelector('.cm-openidea-gutter-colors span[title="#ff0080"]')).not.toBeNull(), + // The parse runs in idle time, which a busy machine gives out slowly. + await vi.waitFor( + () => expect(view!.dom.querySelector('.cm-openidea-gutter-colors span[title="#ff0080"]')).not.toBeNull(), + { timeout: 10_000 }, ); }); diff --git a/src/features/vcs/__tests__/svnToolWindowParity.test.tsx b/src/features/vcs/__tests__/svnToolWindowParity.test.tsx index 78044e6ee5..671e9381f8 100644 --- a/src/features/vcs/__tests__/svnToolWindowParity.test.tsx +++ b/src/features/vcs/__tests__/svnToolWindowParity.test.tsx @@ -855,6 +855,8 @@ describe("Incoming", () => { expect(mocks.svnIncomingRevisions).toHaveBeenLastCalledWith(7300, true); fireEvent.click(screen.getByRole("button", { name: "Refresh" })); await waitFor(() => expect(mocks.svnIncomingRevisions).toHaveBeenLastCalledWith(7300, false)); + // Refresh is disabled until that read has been shown. + await waitFor(() => expect(screen.getByRole("button", { name: "Refresh" })).toBeEnabled()); mocks.requestId = 7400; mocks.svnIncomingRevisions.mockReturnValue(new Promise(() => {}));