Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

fix(e2e): dismiss import-models modal after adding connection (sync-models mock + close)

diegosouzapw11bd96ec5c8d
diff --git a/tests/e2e/providers-management.spec.ts b/tests/e2e/providers-management.spec.ts
index a618e79eaf..dd39c1cceb 100644
--- a/tests/e2e/providers-management.spec.ts
+++ b/tests/e2e/providers-management.spec.ts
@@ -106,6 +106,11 @@ async function installProviderFetchMock(page: Page) {
return jsonResponse({ valid }, valid ? 200 : 400);
}
+ // Stub sync-models so the import modal reaches "done" immediately after adding a connection
+ if (path.match(/^\/api\/providers\/[^/]+\/sync-models$/) && method === "POST") {
+ return jsonResponse({ syncedModels: 0, models: [], availableModelsCount: 0 });
+ }
+
const testMatch = path.match(/^\/api\/providers\/([^/]+)\/test$/);
if (testMatch && method === "POST") {
state.retestCalls += 1;
@@ -261,7 +266,14 @@ test.describe("Providers management", () => {
.toBeGreaterThan(0);
await expect(page.getByText("Primary OpenAI")).toBeVisible();
await expect.poll(async () => (await readProviderMockState(page)).connections.length).toBe(1);
- await expect(addDialog).not.toBeVisible();
+
+ // After save, the UI opens a model-import modal (setShowImportModal). The sync-models
+ // endpoint is mocked to return instantly (0 models), so the modal reaches "done" phase
+ // and shows a Close button. Dismiss it before interacting with the connection list.
+ const importDialog = page.getByRole("dialog");
+ await expect(importDialog.getByRole("button", { name: "Close" })).toBeVisible({ timeout: 15_000 });
+ await importDialog.getByRole("button", { name: "Close" }).click();
+ await expect(importDialog).not.toBeVisible();
await page.getByTitle(/^edit$/i).click();
const editDialog = page.getByRole("dialog");