From d3a0b4c3a4dd4452a8fce7a09c70edc590bf98ec Mon Sep 17 00:00:00 2001 From: stroblme Date: Tue, 25 Aug 2026 21:30:35 +0200 Subject: [PATCH] Panel spec keeps the installation's other panels MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Saving panels replaces the whole list, so the spec's setup deleted every panel it had not created — and with it the credential of the screen on it. It now appends to the stored list and puts the original back in teardown, which also removes its own panel. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_013Gf7WaExcJ9bs3kfJXB3nK --- frontend/tests/panel.spec.ts | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/frontend/tests/panel.spec.ts b/frontend/tests/panel.spec.ts index 1f17c95..d2dcaf9 100644 --- a/frontend/tests/panel.spec.ts +++ b/frontend/tests/panel.spec.ts @@ -1,4 +1,5 @@ import { expect, test } from "@playwright/test" +import type { PanelDef } from "../src/client" import { api, apiPage, deleteAll } from "./utils/api" /** @@ -16,6 +17,8 @@ import { api, apiPage, deleteAll } from "./utils/api" const flowName = `test_panel_${Date.now().toString(36)}` const first = `${flowName}_a` const second = `${flowName}_b` +/** The installation's own panels, put back by the teardown. */ +let panels: PanelDef[] | null = null test.use({ storageState: "playwright/.auth/user.json" }) test.describe.configure({ mode: "serial" }) @@ -69,16 +72,33 @@ test.beforeAll(async ({ browser }) => { }) } + // Saving is a whole-list replace, and a panel that disappears takes the + // credential of the screen hanging on it. So append to what is there, and + // keep the list for the teardown to put back. + const config = await (await api(page, "/panels/")).json() + const existing: PanelDef[] = (config.panels ?? []).filter( + (p: PanelDef) => p.id !== flowName, + ) + panels = existing await api(page, "/panels/", { method: "PUT", data: { - panels: [{ id: flowName, title: "Hall", dashboards: [first, second] }], + panels: [ + ...existing, + { id: flowName, title: "Hall", dashboards: [first, second] }, + ], }, }) await page.close() }) test.afterAll(async ({ browser }) => { + // Restoring the list is also what removes this spec's own panel. + if (panels) { + const page = await apiPage(browser) + await api(page, "/panels/", { method: "PUT", data: { panels } }) + await page.close() + } await deleteAll(browser, [ `/dashboards/${first}`, `/dashboards/${second}`,