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.
Цей коміт міститься в:
l0ng-ai authored and GitHub committed 2026-12-05 23:59:19 +08:00
1 джерело 1cbb572631
коміт 0c495e2eed
2 files changed
+6 -2

No files matched your search

+4 -2
Переглянути файл
@@ -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 },
);
});
+2
Переглянути файл
@@ -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(() => {}));