Files
moreminimore-vibe/e2e-tests/edit_custom_models.spec.ts
BlueRaw 2c208e3ace add editable custom model (#794)
Now users can free to edit their custom models by double clicking any
custom models created in each provider.
Before this, they have to delete -> create a new one.
I simply add an edit panel (which looks the same as 'Add Custom Model')
and integrate that process into the "update" button.

There is one more issue that if a user deletes a model that he was using
in chat, then back to chat, that model would still appear (and work)
unless user chooses a new one.
Tried to modify "delete-custom-model" in language_model_handlers.ts by
the logic that if the name of that model matches the latest using one ->
switch to auto (or default) model. Yet I failed, maybe need more
explanation for this :)
2025-08-12 21:53:44 -07:00

56 lines
2.0 KiB
TypeScript

import { test } from "./helpers/test_helper";
import { expect } from "@playwright/test";
test("edit custom model", async ({ po }) => {
await po.setUp();
await po.goToSettingsTab();
await po.page.getByText("test-provider").click();
// test edit model by double clicking the model panel
await po.page
.locator(".text-lg.font-semibold", { hasText: "test-model" })
.dblclick({ delay: 100 });
await po.page.locator("#edit-model-id").clear();
await po.page.locator("#edit-model-id").fill("new-model-id");
await po.page.locator("#edit-model-name").clear();
await po.page.locator("#edit-model-name").fill("new-model-name");
await po.page.getByRole("button", { name: "Update Model" }).click();
// assert that the model was updated
await po.page
.locator(".text-lg.font-semibold", { hasText: "new-model-name" })
.dblclick({ delay: 100 });
await expect(po.page.locator("#edit-model-id")).toHaveValue("new-model-id");
await expect(po.page.locator("#edit-model-name")).toHaveValue(
"new-model-name",
);
await po.page.getByRole("button", { name: "Cancel" }).click();
// test edit model by clicking the edit button
await po.page
.locator('button svg path[d*="M11 5H6a2"]')
.locator("..")
.locator("..")
.click();
await po.page.locator("#edit-model-id").clear();
await po.page.locator("#edit-model-id").fill("another-model-id");
await po.page.locator("#edit-model-name").clear();
await po.page.locator("#edit-model-name").fill("another-model-name");
await po.page.getByRole("button", { name: "Update Model" }).click();
// assert that the model was updated
await po.page
.locator(".text-lg.font-semibold", { hasText: "another-model-name" })
.dblclick({ delay: 100 });
await expect(po.page.locator("#edit-model-id")).toHaveValue(
"another-model-id",
);
await expect(po.page.locator("#edit-model-name")).toHaveValue(
"another-model-name",
);
await po.page.getByRole("button", { name: "Cancel" }).click();
// Make sure UI hasn't freezed
await po.goToAppsTab();
});