test(e2e-ui): say why the team-model setup call failed

The setup that creates a team-scoped model asserted a bare `ok()`, so a
failure read "expected true, received false" and pointed at the UI. The call
is enterprise-gated -- creating a model with model_info.team_id returns 403
without LITELLM_LICENSE -- and that is invisible from the old message. It now
carries the status and body, which names the cause immediately.

The api_base also pointed at the mock's default port rather than the one the
harness started; nothing in the test calls the model, but the two should not
disagree.
This commit is contained in:
Yuneng Jiang 2026-08-08 23:00:42 -07:00
parent ffc7e6386b
commit ab97cd53dc
No known key found for this signature in database

View file

@ -58,7 +58,10 @@ test.describe("Add Model", () => {
model_name: modelName,
litellm_params: {
model: "openai/fake-gpt-4",
api_base: "http://127.0.0.1:8090/v1",
// Nothing here ever calls the model, but point it at the mock the
// harness actually started -- the port moves when two checkouts run
// the stack side by side.
api_base: `http://127.0.0.1:${process.env.MOCK_LLM_PORT ?? "8090"}/v1`,
api_key: "fake-key",
tpm: 100,
rpm: 200,
@ -68,7 +71,11 @@ test.describe("Add Model", () => {
},
},
});
expect(createResponse.ok()).toBe(true);
// Say why it failed. A bare toBe(true) here reports "expected true, received
// false" and sends you looking at the UI for a setup call that never landed.
expect(createResponse.ok(), `/model/new failed: ${createResponse.status()} ${await createResponse.text()}`).toBe(
true,
);
const createdModelId = (await createResponse.json()).model_info?.id;
expect(createdModelId, "model id from /model/new").toBeTruthy();