fix: simplify assistant key management

This commit is contained in:
Thomas Camlong authored and ajnart committed 2026-08-14 11:32:11 +02:00
1 parent dfafad15bf
commit b7fdff9f7f
4 files changed
+6 -162

No files matched your search

+2 -22
View File
@@ -12,7 +12,7 @@ const adminCredentials = {
};
describe("Assistant management", () => {
test("keeps provider actions clear and the API key replacement flow responsive", async () => {
test("keeps provider actions clear and responsive", async () => {
const { db, localMountPath } = await createSqliteDbFileAsync();
await seedAdminUserAsync(db, adminCredentials);
await db.insert(sqliteSchema.assistantConfigurations).values({
@@ -51,20 +51,7 @@ describe("Assistant management", () => {
await expect(page.getByText("Connection ready")).toBeVisible();
await expect(page.getByText("Key protected")).toBeVisible();
await expect(page.getByText("Encrypted API key saved")).toBeVisible();
await expect(page.getByRole("button", { name: "Replace key" })).toBeVisible();
await expect(page.getByRole("button", { name: "Remove saved API key" })).toBeVisible();
await page.getByRole("button", { name: "Replace key" }).click();
const newKey = page.getByLabel("New API key");
await expect(newKey).toBeFocused();
await newKey.fill("replacement-test-api-key");
await page.getByRole("button", { name: "Review replacement" }).click();
await expect(page.getByText("The current key will stop being used")).toBeVisible();
await expect(page.getByText("https://openrouter.ai/api/v1", { exact: true })).toBeVisible();
await expect(page.getByRole("button", { name: "Replace API key" })).toBeVisible();
await page.getByRole("button", { name: "Edit new key" }).click();
await page.getByRole("button", { name: "Cancel replacement" }).click();
await page.getByRole("button", { name: "Additional request headers" }).click();
await expect(page.getByRole("button", { name: "Add header" })).toBeVisible();
@@ -77,15 +64,8 @@ describe("Assistant management", () => {
await page.setViewportSize({ width: 390, height: 844 });
await page.reload();
await expect(page.getByRole("heading", { name: "Assistant" })).toBeVisible();
await expect(page.getByRole("button", { name: "Replace key" })).toBeVisible();
await expect(page.getByRole("button", { name: "Remove saved API key" })).toBeVisible();
await expect(page.getByRole("button", { name: "Save assistant" })).toBeVisible();
await page.getByRole("button", { name: "Replace key" }).click();
await expect(page.getByLabel("New API key")).toBeFocused();
await page.getByLabel("New API key").fill("replacement-test-api-key");
await page.getByRole("button", { name: "Review replacement" }).click();
await expect(page.getByText("The current key will stop being used")).toBeVisible();
await expect(page.getByRole("button", { name: "Edit new key" })).toBeVisible();
await expect(page.getByRole("button", { name: "Replace API key" })).toBeVisible();
const hasHorizontalOverflow = await page.evaluate(
() => document.documentElement.scrollWidth > document.documentElement.clientWidth,
);