From 11bd96ec5c8de4d7dc86c13f641026e9c47f6571 Mon Sep 17 00:00:00 2001 From: diegosouzapw Date: Mon, 8 Jun 2026 13:12:37 -0300 Subject: [PATCH] fix(e2e): dismiss import-models modal after adding connection (sync-models mock + close) --- tests/e2e/providers-management.spec.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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");