mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-28 00:00:38 +00:00
* test(ui): cover saving MCP tool search settings end to end Adds Playwright coverage for the Tool Search tab on the MCP Servers page: the exact PATCH body a prefilled edit sends and the values shown after a reload, Top K clamping to the largest value the proxy accepts, and a failed save that keeps the edits and succeeds on retry. * refactor(ui): move MCP tool search settings onto the form kit The Tool Search form on the MCP Servers page now uses useZodForm with a zod schema beside it. The schema accepts every value the fields can hold, so the form rejects nothing it accepted before. The existing helpers move unchanged from toolSearchForm.ts to mapper.ts, and its unit test moves with them. * test(ui): wait for the clamped Top K save to finish before cleanup The clamp test returned as soon as it had checked the request body, so the afterEach reset could land before the UI's save and leave top_k at 100 for the rest of the suite. It now waits for the success toast. * test(ui): cover web search and semantic filter settings Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(ui): wait for the restored web search provider Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(ui): isolate settings fixture readiness Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * refactor(ui): move semantic filter and web search settings onto the form kit Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
40 lines
1.4 KiB
TypeScript
40 lines
1.4 KiB
TypeScript
import { expect, type APIRequestContext, type APIResponse, type Page } from "@playwright/test";
|
|
import { masterKey, rootPath } from "./traffic";
|
|
|
|
export async function writeProxySettings(request: APIRequestContext, name: string, settings: object) {
|
|
const response = await request.patch(`${rootPath()}/update/${name}`, {
|
|
headers: { Authorization: `Bearer ${masterKey()}` },
|
|
data: settings,
|
|
});
|
|
expect(response.ok(), await response.text()).toBe(true);
|
|
}
|
|
|
|
export async function seedProxySettings(request: APIRequestContext, page: Page, name: string, settings: object) {
|
|
await writeProxySettings(request, name, settings);
|
|
await page.route(
|
|
`**/get/${name}`,
|
|
async (route) => {
|
|
const headers = { ...(await route.request().allHeaders()), Connection: "close" };
|
|
let response: APIResponse | undefined;
|
|
try {
|
|
await expect
|
|
.poll(
|
|
async () => {
|
|
await response?.dispose();
|
|
response = await route.fetch({ headers });
|
|
return response.ok() ? (await response.json()).values : response.status();
|
|
},
|
|
{ timeout: 30000, message: `Seed ${name}` },
|
|
)
|
|
.toEqual(settings);
|
|
await route.fulfill({ response });
|
|
} catch (error) {
|
|
await route.abort();
|
|
throw error;
|
|
} finally {
|
|
await response?.dispose();
|
|
}
|
|
},
|
|
{ times: 1 },
|
|
);
|
|
}
|