fix(app): seed changes tab in explorer pane even when setup tab occupies it

The explorer companion pane retention commit (de9e85862) auto-opens the
setup progress tab into the hidden explorer pane. toggleWorkspaceExplorerPane
only seeded the working_diff (Changes) tab when the pane was completely
empty, so once the setup tab landed there, clicking the explorer toggle
could never surface Changes/Files again via that pane's default tab.

Also fixes two e2e testid locators (workspace-new-tab-menu-trigger) and
one unit test assertion (browser automation handler) that assumed a bare
pane root, which predates that same explorer-pane-retention change: the
workspace root is now always a group with a hidden companion pane, so
unscoped locators/assertions must target the visible/named pane.
This commit is contained in:
Mohamed Boudra
2026-08-18 15:20:06 +02:00
parent c09be7efa2
commit bd3f3c7714
3 changed files with 26 additions and 8 deletions
@@ -4,6 +4,7 @@ import { createJSONStorage, type StateStorage } from "zustand/middleware";
import { mountBrowserAutomationHandler } from "./handler";
import type { DesktopHostBridge } from "@/desktop/host";
import { useBrowserStore } from "@/desktop/browser/store";
import { findPaneById } from "@/stores/workspace-layout-actions";
import { useWorkspaceLayoutStore } from "@/stores/workspace-layout-store";
import { buildWorkspaceTabPersistenceKey } from "@/workspace-tabs/model";
@@ -306,11 +307,15 @@ describe("mountBrowserAutomationHandler", () => {
target: { kind: "browser", browserId: result.browserId },
}),
]);
expect(layout?.root).toEqual(
expect.objectContaining({
kind: "pane",
pane: expect.objectContaining({ focusedTabId: previousFocusedTabId }),
}),
// Workspaces keep a stable hidden explorer companion pane at the root
// (see "retain workspace explorer pane"), so the root is a group and the
// draft/browser tabs land in the "main" pane, not at the root directly.
if (!layout) {
throw new Error("Expected workspace layout");
}
expect(layout.root.kind).toBe("group");
expect(findPaneById(layout.root, "main")).toEqual(
expect.objectContaining({ focusedTabId: previousFocusedTabId }),
);
expect(openedTabs[0]?.tabId).not.toBe(previousFocusedTabId);
expect(browser.browser.activeWorkspaceBrowsers).toEqual([]);