Skip to content

Self-improving AI Employees for everyone

test(credentials): load the lazy panels before the tests wait on them

trohitgac6266af3e8a
diff --git a/client/src/components/credentials/__tests__/ConnectionKinds.test.tsx b/client/src/components/credentials/__tests__/ConnectionKinds.test.tsx
index 8bc07d4a..a4bc7296 100644
--- a/client/src/components/credentials/__tests__/ConnectionKinds.test.tsx
+++ b/client/src/components/credentials/__tests__/ConnectionKinds.test.tsx
@@ -1,5 +1,5 @@
/** Connection essentials stay usable in both presentations through the real renderer. */
-import { beforeEach, describe, expect, it, vi } from 'vitest';
+import { beforeAll, beforeEach, describe, expect, it, vi } from 'vitest';
import { render, screen, waitFor, within } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
@@ -41,6 +41,11 @@ function mount(config: ProviderConfig, showTechnicalSections: boolean) {
};
}
+// Panels are lazy chunks: load them up front so no case's first 1 s wait includes the cold import.
+beforeAll(async () => {
+ await Promise.all([import('../panels/EmailPanel'), import('../panels/BrowserProfilesPanel'), import('../panels/OAuthPanel')]);
+});
+
beforeEach(() => {
vi.resetAllMocks();
mocks.sendRequest.mockResolvedValue({ success: true, hasKey: false });
diff --git a/client/src/components/credentials/__tests__/PanelRenderer.test.tsx b/client/src/components/credentials/__tests__/PanelRenderer.test.tsx
index fd1eb932..1bfa6357 100644
--- a/client/src/components/credentials/__tests__/PanelRenderer.test.tsx
+++ b/client/src/components/credentials/__tests__/PanelRenderer.test.tsx
@@ -1,4 +1,4 @@
-import { beforeEach, describe, expect, it, vi } from 'vitest';
+import { beforeAll, beforeEach, describe, expect, it, vi } from 'vitest';
import { render, screen, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
@@ -62,6 +62,11 @@ function renderPanel(config: ProviderConfig, showTechnicalSections?: boolean) {
};
}
+// Panels are lazy chunks: load them up front so no case's first 1 s wait includes the cold import.
+beforeAll(async () => {
+ await Promise.all([import('../panels/ApiKeyPanel'), import('../panels/OAuthPanel'), import('../panels/QrPairingPanel')]);
+});
+
beforeEach(() => {
vi.clearAllMocks();
mocks.sendRequest.mockResolvedValue({ hasKey: false });