"use strict"; // Offline integration check: production renderer, preload, IPC, vault and bundled plugin runtime. const { app, BrowserWindow, ipcMain, protocol, clipboard } = require("electron"); const assert = require("node:assert/strict"); const fs = require("node:fs"); const os = require("node:os"); const path = require("node:path"); const { createMainWindow, hardenSession } = require("../src/main/bootstrap/createMainWindow"); const { registerCoreIpc } = require("../src/main/ipc/registerCoreIpc"); const { ConfigStore } = require("../src/main/config/configStore"); const { VaultStore } = require("../src/main/security/vaultStore"); const { ProfileService } = require("../src/main/profiles/profileService"); const { PluginRegistry } = require("../src/main/plugins/pluginRegistry"); const { PluginRuntime } = require("../src/main/plugins/pluginRuntime"); const { PluginService } = require("../src/main/plugins/pluginService"); const { LocalHashService } = require("../src/main/hashing/localHashService"); const { DiagnosticsService } = require("../src/main/diagnostics/diagnosticsService"); const root = fs.mkdtempSync(path.join(os.tmpdir(), "chj-workspace-ui-")); app.setPath("userData", root); protocol.registerSchemesAsPrivileged([{ scheme: "chj-plugin", privileges: { standard: true, secure: true, supportFetchAPI: true } }]); let window, runtime, diagnostics, config, profiles; let nextImport, nextExport; const errors = []; const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); const js = (source) => window.webContents.executeJavaScript(source); async function until(source, timeout = 10000) { const started = Date.now(); while (Date.now() - started < timeout) { if (await js(`(() => { try { return (${source}); } catch { return false; } })()`)) return; await delay(40); } throw new Error(`UI condition timed out: ${source}`); } async function run() { await app.whenReady(); hardenSession(); config = new ConfigStore(root); config.load(); config.update({ updates: { autoCheck: false } }); const vault = new VaultStore(root); await vault.create("ui-smoke-password"); profiles = new ProfileService(vault); const first = profiles.save({ label: "NGINX", host: "NGINX.lan", username: "nginx", storePassword: true, password: "must-stay-in-vault" }); profiles.save({ label: "IPv6", host: "2001:db8::10", username: "admin", port: 2222 }); const registry = new PluginRegistry(root, null, { bundledRoot: path.join(__dirname, "../src/main/firstPartyPlugins") }); window = createMainWindow(); const watchErrors = (webContents) => webContents.on("console-message", (event) => { if (event.level === "error") { errors.push(event.message); console.error(event.message); } }); watchErrors(window.webContents); runtime = new PluginRuntime({ BrowserWindow, registry, sessionManager: { list: () => [] }, localHashService: new LocalHashService(), logService: { readTail: () => ({ text: "", size: 0, readAt: new Date().toISOString(), truncated: false }) }, preload: path.join(__dirname, "../src/preload/pluginPreload.js"), getMainWindow: () => window, getLanguage: () => config.get().ui.language, isVaultUnlocked: () => vault.status().unlocked }); runtime.registerIpc(ipcMain); const pluginService = new PluginService({ registry, runtime, configStore: config }); diagnostics = new DiagnosticsService({ storageRoot: root }); registerCoreIpc({ ipcMain, app, clipboard, configStore: config, vaultStore: vault, profileService: profiles, pluginRegistry: registry, pluginService, pluginRuntime: runtime, diagnosticsService: diagnostics, biometricService: { requireSensitiveAction: async () => {}, getStatus: () => ({ available: false, enabled: false, code: "BIOMETRIC_UNAVAILABLE" }) }, updateService: { getState: () => ({ currentVersion: "0.0.1", status: "idle", releases: [] }) }, getMainWindow: () => window, dialog: { showOpenDialog: async () => nextImport ? { canceled: false, filePaths: [nextImport] } : { canceled: true, filePaths: [] }, showSaveDialog: async () => nextExport ? { canceled: false, filePath: nextExport } : { canceled: true } } }); await until('state.profiles.length === 2 && document.querySelectorAll("#pluginRows .plugin-row").length === 8'); assert.equal(await js('document.querySelector("#navigationEditToggle").checked'), false); assert.equal(await js('document.querySelectorAll(".navigation-controls").length'), 0); assert.equal(await js('[...document.querySelectorAll(".navigation-row")].some(row => row.draggable)'), false); const dropTerminal = '{ const dataTransfer = new DataTransfer(); dataTransfer.setData("text/chj-navigation", "terminal"); document.querySelector("[data-nav-key=overview]").dispatchEvent(new DragEvent("drop", { dataTransfer, bubbles: true })); }'; await js(dropTerminal); assert.deepEqual(config.get().ui.navigationOrder, []); await js('document.querySelector("#navigationEditToggle").click();'); assert.equal(await js('[...document.querySelectorAll(".navigation-row")].every(row => row.draggable)'), true); await js('{ const dataTransfer = new DataTransfer(); document.querySelector("[data-nav-key=terminal]").dispatchEvent(new DragEvent("dragstart", { dataTransfer, bubbles: true })); if (dataTransfer.getData("text/chj-navigation") !== "terminal") throw new Error("Missing drag payload"); document.querySelector("[data-nav-key=overview]").dispatchEvent(new DragEvent("drop", { dataTransfer, bubbles: true })); }'); await until('document.querySelector("#mainNavigation").firstElementChild.dataset.navKey === "terminal"'); assert.equal(new ConfigStore(root).load().ui.navigationOrder[0], "terminal"); await js(`showView('plugins'); document.querySelector('[data-plugin-id="chj.system-monitor"] .plugin-pin').click();`); await until(`Boolean(document.querySelector('[data-nav-key="plugin:chj.system-monitor"]'))`); await js('{ const dataTransfer = new DataTransfer(); dataTransfer.setData("text/chj-navigation", "plugin:chj.system-monitor"); document.querySelector("[data-nav-key=terminal]").dispatchEvent(new DragEvent("drop", { dataTransfer, bubbles: true })); }'); await until('document.querySelector("#mainNavigation").firstElementChild.dataset.navKey === "plugin:chj.system-monitor"'); await js('document.querySelector("#navigationEditToggle").click();'); await js(dropTerminal); assert.equal(await js('document.querySelector("#mainNavigation").firstElementChild.dataset.navKey'), "plugin:chj.system-monitor"); await js(`document.querySelector('[data-plugin-id="chj.hash-checksum"] .plugin-visibility').click();`); await until('!document.querySelector("#hashToolButton") && document.querySelector("#pluginRows .plugin-hidden .button").disabled'); assert.equal(await js('document.querySelector("#pluginRows .plugin-hidden .plugin-pin").disabled'), true); await js(`document.querySelector('[data-plugin-id="chj.hash-checksum"] .plugin-visibility').click();`); await until('document.querySelectorAll("#pluginRows .plugin-hidden").length === 0'); assert.equal(await js('document.querySelectorAll("#pluginRows select").length'), 0); assert.equal(await js('document.querySelectorAll("#pluginRows details[open]").length'), 0); assert.equal(await js('document.querySelector(".plugin-catalog-disclosure").open'), false); await js('document.querySelector("#pluginRows details summary").click();'); assert.equal(await js('document.querySelector("#pluginRows details").open'), true); await js('document.querySelector("#pluginRows details summary").click();'); // Open every packaged tool through the real sandboxed runtime, without SSH/network access. for (const plugin of registry.listInstalled()) { runtime.open(plugin.id); const pluginWindow = runtime.windows.get(plugin.id); watchErrors(pluginWindow.webContents); await new Promise((resolve, reject) => { pluginWindow.webContents.once("did-finish-load", resolve); pluginWindow.webContents.once("did-fail-load", (_e, code, description) => reject(new Error(`${plugin.id}: ${code} ${description}`))); }); await delay(180); assert.equal(pluginWindow.webContents.getLastWebPreferences().nodeIntegration, false); assert.equal(pluginWindow.webContents.getLastWebPreferences().sandbox, true); assert.equal(await pluginWindow.webContents.executeJavaScript('typeof window.process'), "undefined"); assert.ok(await pluginWindow.webContents.executeJavaScript('Boolean(window.chjPlugin && document.body.textContent.length > 50)')); runtime.close(plugin.id); } nextImport = path.join(root, "import.json"); fs.writeFileSync(nextImport, JSON.stringify({ format: "chj-server-profiles", version: 1, servers: [ { name: "NGINX import", host: "NGINX.lan", username: "nginx", port: 22, password: "never-import" }, { name: "NovĂ˝ server", host: "192.168.10.100", username: "root", port: 22 } ] })); await js('showView("profiles"); document.querySelector("#importProfilesButton").click();'); await until('document.querySelector("#profileImportDialog").open'); assert.equal(profiles.list().length, 2); assert.equal(await js('document.querySelectorAll("#profileImportRows tr").length'), 2); await js('document.querySelector("#cancelProfileImport").click();'); assert.equal(profiles.list().length, 2); await js('document.querySelector("#importProfilesButton").click();'); await until('document.querySelector("#profileImportDialog").open'); await js('document.querySelector("#profileDuplicatePolicy").value = "update"; document.querySelector("#confirmProfileImport").click();'); await until('!document.querySelector("#profileImportDialog").open && state.profiles.length === 3'); assert.equal(profiles.getStoredPassword(first.id), null); for (const format of ["json", "csv"]) { nextExport = path.join(root, `export.${format}`); await js(`document.querySelector('#profileExportFormat').value = '${format}'; document.querySelector('#exportProfilesButton').click();`); await until('!document.querySelector("#exportProfilesButton").disabled'); assert.doesNotMatch(fs.readFileSync(nextExport, "utf8"), /must-stay-in-vault|never-import|privateKey|token|password/i); assert.match(fs.readFileSync(nextExport, "utf8"), /NGINX\.lan/); } nextExport = path.join(root, "selected.json"); await js('document.querySelector("#profileRows input").click(); document.querySelector("#exportSelectedProfiles").checked = true; document.querySelector("#profileExportFormat").value = "json"; document.querySelector("#exportProfilesButton").click();'); await until('!document.querySelector("#exportProfilesButton").disabled'); assert.equal(JSON.parse(fs.readFileSync(nextExport, "utf8")).servers.length, 1); nextImport = path.join(root, "export.csv"); await js('document.querySelector("#importProfilesButton").click();'); await until('document.querySelector("#profileImportDialog").open'); assert.equal(await js('document.querySelectorAll("#profileImportRows tr").length'), 3); await js('document.querySelector("#confirmProfileImport").click();'); await until('!document.querySelector("#profileImportDialog").open'); assert.equal(profiles.list().length, 3); // Default skip preserves existing profiles. for (const language of ["cs", "de", "en"]) { await js(`applyLanguage('${language}')`); assert.equal(await js('document.querySelector("#profileImportTitle").textContent.includes("transfer.")'), false); } await window.webContents.reload(); await until('document.querySelector("#mainNavigation").firstElementChild.dataset.navKey === "plugin:chj.system-monitor" && state.profiles.length === 3'); assert.equal(await js('document.querySelector("#navigationEditToggle").checked'), false); await sidebarChecks(); await iconChecks(); window.setSize(960, 720); for (const view of ["plugins", "profiles"]) { await js(`showView('${view}')`); await delay(80); assert.equal(await js('document.documentElement.scrollWidth <= window.innerWidth'), true, `${view} must fit the minimum window width`); } const artifacts = process.env.CHJ_WORKSPACE_SMOKE_ARTIFACT_DIR; if (artifacts) { fs.mkdirSync(artifacts, { recursive: true }); window.setSize(1240, 900); for (const view of ["plugins", "profiles"]) { await js(`showView('${view}')`); await delay(350); fs.writeFileSync(path.join(artifacts, `${view}.png`), (await window.webContents.capturePage()).toPNG()); } } assert.deepEqual(errors, []); console.log("CHJ_WORKSPACE_UI_OK: locked/unlocked mouse reorder/persistence, compact plugin checkboxes, eight bundled sandboxed plugins, sidebar full/compact/split/hidden with resize, tooltips, shortcut and persistence, hide/show/pin, import preview/cancel/update, secret-free JSON/CSV, selected export, CZ/DE/EN, minimum window width"); } // Sidebar modes with real input events (mouse drag, hover, keyboard), persistence through ConfigStore and reload. async function sidebarChecks() { const shots = process.env.CHJ_WORKSPACE_SMOKE_ARTIFACT_DIR; const shot = async (name) => { if (shots) { fs.mkdirSync(shots, { recursive: true }); await delay(250); fs.writeFileSync(path.join(shots, `sidebar-${name}.png`), (await window.webContents.capturePage()).toPNG()); } }; const rect = (selector) => js(`(() => { const r = document.querySelector(${JSON.stringify(selector)}).getBoundingClientRect(); return { left: r.left, right: r.right, top: r.top, width: r.width, height: r.height }; })()`); const send = (event) => window.webContents.sendInputEvent(event); const settle = () => delay(260); window.setSize(1240, 860); await settle(); await js("showView('overview')"); assert.deepEqual(config.get().ui.sidebar, { mode: "full", hidden: false, width: 248 }); assert.equal(Math.round((await rect("#sidebar")).width), 248); // Drag the resize handle with the mouse. const handle = await rect("#sidebarResizer"); const x = Math.round(handle.left + handle.width / 2); const y = Math.round(handle.top + 300); send({ type: "mouseMove", x, y }); send({ type: "mouseDown", x, y, button: "left", clickCount: 1 }); for (let step = 1; step <= 10; step += 1) { send({ type: "mouseMove", x: x + step * 8, y, modifiers: ["leftButtonDown"] }); await delay(15); } send({ type: "mouseUp", x: x + 80, y, button: "left", clickCount: 1 }); await until("state.config.ui.sidebar.width >= 320 && state.config.ui.sidebar.width <= 336"); await settle(); const widened = config.get().ui.sidebar.width; assert.ok(Math.abs((await rect("#sidebar")).width - widened) <= 1, "sidebar follows the drag"); assert.ok(Math.abs((await rect("main")).left - widened) <= 1, "main content starts after the sidebar"); send({ type: "mouseDown", x: x + 80, y, button: "left", clickCount: 1 }); send({ type: "mouseMove", x: 1200, y, modifiers: ["leftButtonDown"] }); send({ type: "mouseUp", x: 1200, y, button: "left", clickCount: 1 }); await until("state.config.ui.sidebar.width === 420"); await js('document.querySelector("#sidebarResizer").focus()'); send({ type: "keyDown", keyCode: "Left" }); send({ type: "keyUp", keyCode: "Left" }); await until("state.config.ui.sidebar.width === 404"); await js('document.querySelector("#sidebarResizer").dispatchEvent(new MouseEvent("dblclick", { bubbles: true }))'); await until("state.config.ui.sidebar.width === 248"); await shot("full"); // Compact: icons only, tooltip with the full name on hover. await js('document.querySelector(".sidebar-mode[data-sidebar-mode=compact]").click()'); await until('document.querySelector(".app-shell").dataset.sidebarMode === "compact"'); await settle(); assert.equal(Math.round((await rect("#sidebar")).width), 76); assert.ok((await rect('[data-nav-key="diagnostics"] .nav-label')).width <= 1, "labels are visually hidden"); const diag = await rect('[data-nav-key="diagnostics"] .nav-button'); send({ type: "mouseMove", x: Math.round(diag.left + diag.width / 2), y: Math.round(diag.top + diag.height / 2) }); await until('!document.querySelector("#sidebarTooltip").hidden'); const expected = await js('document.querySelector(\'[data-nav-key="diagnostics"] .nav-label\').textContent'); assert.equal(await js('document.querySelector("#sidebarTooltip").textContent'), expected); assert.ok((await rect("#sidebarTooltip")).left > (await rect("#sidebar")).right, "tooltip is next to the sidebar"); assert.equal(await js('getComputedStyle(document.querySelector("#sidebarTooltip")).pointerEvents'), "none"); await shot("compact"); send({ type: "mouseDown", x: Math.round(diag.left + diag.width / 2), y: Math.round(diag.top + diag.height / 2), button: "left", clickCount: 1 }); send({ type: "mouseUp", x: Math.round(diag.left + diag.width / 2), y: Math.round(diag.top + diag.height / 2), button: "left", clickCount: 1 }); await until('document.querySelector("[data-view-panel=diagnostics]").classList.contains("active")'); assert.equal(await js('document.querySelector("#sidebarTooltip").hidden'), true, "clicking hides the tooltip"); // Split: two icon columns; keyboard focus shows the tooltip too. await js('document.querySelector(".sidebar-mode[data-sidebar-mode=split]").click()'); await until('document.querySelector(".app-shell").dataset.sidebarMode === "split"'); await settle(); assert.equal(Math.round((await rect("#sidebar")).width), 132); const rows = await js('[...document.querySelectorAll("#mainNavigation .navigation-row")].map((row) => Math.round(row.getBoundingClientRect().top))'); assert.equal(rows[0], rows[1], "first two items share a row"); assert.ok(rows[2] > rows[0]); // Real Tab key presses from the mode switch into the icon grid (works also when the window is not in the foreground). await js('document.activeElement?.blur(); document.querySelector(".sidebar-mode[data-sidebar-mode=split]").focus()'); assert.equal(await js('document.activeElement.dataset.sidebarMode'), "split", "keyboard walk starts at the mode switch"); for (let press = 0; press < 6 && (press === 0 || !(await js('Boolean(document.activeElement.closest("#mainNavigation"))'))); press += 1) { send({ type: "keyDown", keyCode: "Tab" }); send({ type: "keyUp", keyCode: "Tab" }); await delay(60); } assert.equal(await js('Boolean(document.activeElement.closest("#mainNavigation .nav-button"))'), true, "Tab reaches the icon grid"); // A window without OS focus (e.g. started from a non-interactive SSH session on Windows) drops element focus at once; // the keyboard tooltip is only meaningful and checked in a focused window. if (await js("document.hasFocus()")) { await until('!document.querySelector("#sidebarTooltip").hidden'); assert.equal(await js('document.querySelector("#sidebarTooltip").textContent'), await js('document.activeElement.querySelector(".nav-label").textContent')); } else console.log("NOTE: keyboard-focus tooltip not checked: the window has no OS focus in this session"); await shot("split"); // Hide with the menu button; the content takes the full width; the shortcut restores the last mode. await js('document.querySelector("#sidebarToggle").click()'); await until('document.querySelector(".app-shell").classList.contains("sidebar-hidden")'); await settle(); assert.equal(await js('getComputedStyle(document.querySelector("#sidebar")).display'), "none"); const fullMain = await rect("main"); assert.ok(fullMain.left <= 1 && fullMain.width >= (await js("document.documentElement.clientWidth")) - 2, `main uses the whole width (${JSON.stringify(fullMain)})`); assert.equal(await js('document.querySelector("#sidebarToggle").getAttribute("aria-expanded")'), "false"); await until("state.config.ui.sidebar.hidden === true"); assert.deepEqual(config.get().ui.sidebar, { mode: "split", hidden: true, width: 248 }); await shot("hidden"); send({ type: "keyDown", keyCode: "B", modifiers: [process.platform === "darwin" ? "meta" : "control", "shift"] }); send({ type: "keyUp", keyCode: "B", modifiers: [process.platform === "darwin" ? "meta" : "control", "shift"] }); await until('!document.querySelector(".app-shell").classList.contains("sidebar-hidden") && document.querySelector(".app-shell").dataset.sidebarMode === "split"'); // Persistence across a restart of the renderer. await js('document.querySelector("#sidebarToggle").click()'); await until("state.config.ui.sidebar.hidden === true"); await window.webContents.reload(); await until('document.querySelector(".app-shell").dataset.sidebarMode === "split" && document.querySelector(".app-shell").classList.contains("sidebar-hidden")'); await js('document.querySelector("#sidebarToggle").click()'); await until('!document.querySelector(".app-shell").classList.contains("sidebar-hidden")'); await js('document.querySelector(".sidebar-mode[data-sidebar-mode=full]").click()'); await until("state.config.ui.sidebar.mode === 'full' && state.config.ui.sidebar.hidden === false"); assert.equal(await js('document.querySelector("#navigationEditToggle").checked'), false); } // Navigation icons: shared SVG per stable ID in every mode and in the minimized-plugin taskbar. async function iconChecks() { const shots = process.env.CHJ_WORKSPACE_SMOKE_ARTIFACT_DIR; const shot = async (name) => { if (shots) { fs.mkdirSync(shots, { recursive: true }); await delay(250); fs.writeFileSync(path.join(shots, `icons-${name}.png`), (await window.webContents.capturePage()).toPNG()); } }; const send = (event) => window.webContents.sendInputEvent(event); window.setSize(1240, 1000); await delay(200); await js("showView('plugins')"); await js('[...document.querySelectorAll("#pluginRows .plugin-pin")].filter((pin) => !pin.checked && !pin.disabled).forEach((pin) => pin.click())'); await until('document.querySelectorAll("#mainNavigation .navigation-row").length === 15', 15000); await js("showView('overview')"); const order = await js('[...document.querySelectorAll("#mainNavigation .navigation-row")].map((row) => row.dataset.navKey)'); const rows = await js(`[...document.querySelectorAll("#mainNavigation .navigation-row")].map((row) => { const svg = row.querySelector("svg.nav-icon"); const box = svg?.getBoundingClientRect(); return { key: row.dataset.navKey, icon: svg?.dataset.icon, expected: window.chjNavIcons.iconName(row.dataset.navKey), shapes: svg?.childElementCount || 0, w: box?.width, h: box?.height, glyph: row.querySelector(".nav-button > span:not(.nav-label)")?.textContent || "" }; })`); for (const row of rows) { assert.equal(row.icon, row.expected, `${row.key} icon`); assert.notEqual(row.icon, "puzzle", `${row.key} has a specific icon`); assert.ok(row.shapes > 0, `${row.key} SVG has shapes`); assert.equal(row.glyph, "", `${row.key} has no old text glyph`); assert.equal(Math.round(row.w), 22); assert.equal(Math.round(row.h), 22); } assert.equal(new Set(rows.map((row) => row.icon)).size, rows.length, "unique icons"); const fullButton = await js('document.querySelector("#mainNavigation .nav-button").getBoundingClientRect().height'); assert.ok(fullButton >= 48, `full-mode click area ${fullButton}`); await shot("full"); for (const mode of ["compact", "split"]) { await js(`document.querySelector(".sidebar-mode[data-sidebar-mode=${mode}]").click()`); await until(`document.querySelector(".app-shell").dataset.sidebarMode === "${mode}"`); await delay(200); const sizes = await js('[...document.querySelectorAll("#mainNavigation .navigation-row")].map((row) => { const b = row.querySelector(".nav-button").getBoundingClientRect(); const i = row.querySelector("svg.nav-icon").getBoundingClientRect(); return [Math.round(b.width), Math.round(b.height), Math.round(i.width), Math.round(i.height), Math.round(i.left + i.width / 2 - (b.left + b.width / 2)), Math.round(i.top + i.height / 2 - (b.top + b.height / 2)), Math.round(b.left), Math.round(b.top), Math.round(b.right)]; })'); const sidebarRight = await js('document.querySelector("#sidebar").getBoundingClientRect().right'); for (const [bw, bh, iw, ih, dx, dy, , , right] of sizes) { assert.deepEqual([bw, bh, iw, ih], [52, 52, 26, 26], `${mode} sizes`); assert.ok(Math.abs(dx) <= 1 && Math.abs(dy) <= 1, `${mode} icon centered`); assert.ok(right <= sidebarRight, `${mode} button inside the sidebar`); } assert.equal(await js('(() => { const nav = document.querySelector("#mainNavigation"); return nav.scrollWidth <= nav.clientWidth; })()'), true, `${mode}: no horizontal overflow`); const columns = new Set(sizes.map((entry) => entry[6])); assert.equal(columns.size, mode === "split" ? 2 : 1, `${mode} columns`); assert.deepEqual(await js('[...document.querySelectorAll("#mainNavigation .navigation-row")].map((row) => row.dataset.navKey)'), order, "custom order kept"); // Tooltip after ~300 ms hover, not immediately. const target = await js('(() => { const r = document.querySelector("[data-nav-key=\'plugin:chj.disks\'] .nav-button").getBoundingClientRect(); return { x: Math.round(r.left + r.width / 2), y: Math.round(r.top + r.height / 2) }; })()'); send({ type: "mouseMove", x: 5, y: 5 }); await delay(60); send({ type: "mouseMove", x: target.x, y: target.y }); await delay(120); assert.equal(await js('document.querySelector("#sidebarTooltip").hidden'), true, "no tooltip before the delay"); await until('!document.querySelector("#sidebarTooltip").hidden', 2000); assert.equal(await js('document.querySelector("#sidebarTooltip").textContent'), "Disk Manager"); await shot(mode); send({ type: "mouseMove", x: 900, y: 500 }); await delay(60); } await js('document.querySelector(".sidebar-mode[data-sidebar-mode=full]").click()'); await until("state.config.ui.sidebar.mode === 'full'"); // Minimized-plugin taskbar uses the same icons; unknown plugins get the neutral fallback. await js('renderPluginTaskbar([{ pluginId: "chj.disks", name: "Disk Manager", minimized: true }, { pluginId: "example.unknown", name: "Example", minimized: true }])'); assert.deepEqual(await js('[...document.querySelectorAll(".plugin-taskbar-item svg.nav-icon")].map((svg) => svg.dataset.icon)'), ["hard-drive", "puzzle"]); await shot("taskbar"); await js("renderPluginTaskbar([])"); } function finish(code) { runtime?.closeAll(); diagnostics?.stopAll(); window?.destroy(); try { fs.rmSync(root, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 }); } catch {} app.exit(code); } run().then(() => finish(0), (error) => { console.error(error); finish(1); }); setTimeout(() => { console.error("Workspace UI smoke exceeded 120s"); finish(1); }, 120000).unref();