Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(sandbox-panel): wait for the loaded panel, not for the load to start

Nguyen Thanh Dat9ec0f98e5026
diff --git a/app/src/components/settings/panels/__tests__/SandboxSettingsPanel.validation.test.tsx b/app/src/components/settings/panels/__tests__/SandboxSettingsPanel.validation.test.tsx
index 165c5e4cad..1952aa6a9e 100644
--- a/app/src/components/settings/panels/__tests__/SandboxSettingsPanel.validation.test.tsx
+++ b/app/src/components/settings/panels/__tests__/SandboxSettingsPanel.validation.test.tsx
@@ -66,7 +66,16 @@ const mockIsTauri = vi.mocked(isTauri);
async function renderLoaded(overrides: Partial<SandboxSettings> = {}) {
mockGet.mockResolvedValue({ result: sandboxSettings(overrides), logs: [] });
renderWithProviders(<SandboxSettingsPanel />);
- await waitFor(() => expect(mockGet).toHaveBeenCalled());
+ // Not `waitFor(() => expect(mockGet).toHaveBeenCalled())`: the panel calls
+ // openhumanGetSandboxSettings synchronously inside its mount effect, so that
+ // assertion already holds on waitFor's first tick, while isLoading is still
+ // true and the panel is rendering the loading paragraph. The synchronous
+ // getBy* accessors below then query a DOM that has no fields in it yet. The
+ // same trap is described under flushPersist; it applies to readiness too.
+ //
+ // The backend select is rendered only by the loaded branch and by every
+ // override these tests pass, so awaiting it is the signal that was meant.
+ await screen.findByRole('combobox', { name: /backend/i });
}
/**