Any new-tab target (new agent, terminal, browser, or a terminal profile) can be pinned as a quick-launch button. Pins are global client app state (persisted), not daemon config, so the same set shows on every workspace; profile pins resolve per host and are dropped where that profile is absent. The sidebar mirror launches via a navigate-then-launch intent store rather than calling the create handlers directly: terminal creation only works in the mounted/focused workspace, so the sidebar requests the launch and the workspace screen consumes it on focus.
68 lines
2.4 KiB
TypeScript
68 lines
2.4 KiB
TypeScript
import { test, expect } from "./fixtures";
|
|
import { gotoWorkspace } from "./helpers/launcher";
|
|
import { gotoAppShell } from "./helpers/app";
|
|
import { getServerId } from "./helpers/server-id";
|
|
import { seedWorkspace, type SeededWorkspace } from "./helpers/seed-client";
|
|
import { togglePinFromMenu, tabRowPin, sidebarPin } from "./helpers/pins";
|
|
import { expectTerminalTabOpen } from "./helpers/workspace-tabs";
|
|
import type { PinnedTabTarget } from "../src/workspace-pins/target";
|
|
|
|
const TERMINAL_TARGET: PinnedTabTarget = { kind: "terminal" };
|
|
|
|
let workspace: SeededWorkspace;
|
|
|
|
test.beforeAll(async () => {
|
|
workspace = await seedWorkspace({ repoPrefix: "workspace-pins-e2e-" });
|
|
});
|
|
|
|
test.afterAll(async () => {
|
|
await workspace?.cleanup();
|
|
});
|
|
|
|
test.describe("Pinned tab targets", () => {
|
|
test("pinning a target from the dropdown adds its quick-launch button to the tab row, unpinning removes it", async ({
|
|
page,
|
|
}) => {
|
|
await gotoWorkspace(page, workspace.workspaceId);
|
|
|
|
await expect(tabRowPin(page, TERMINAL_TARGET)).toHaveCount(0);
|
|
|
|
await togglePinFromMenu(page, TERMINAL_TARGET);
|
|
await expect(tabRowPin(page, TERMINAL_TARGET)).toBeVisible({ timeout: 10_000 });
|
|
|
|
await togglePinFromMenu(page, TERMINAL_TARGET);
|
|
await expect(tabRowPin(page, TERMINAL_TARGET)).toHaveCount(0, { timeout: 10_000 });
|
|
});
|
|
|
|
test("clicking the pinned quick-launch button in the tab row opens a terminal tab", async ({
|
|
page,
|
|
}) => {
|
|
test.setTimeout(45_000);
|
|
await gotoWorkspace(page, workspace.workspaceId);
|
|
|
|
await togglePinFromMenu(page, TERMINAL_TARGET);
|
|
await tabRowPin(page, TERMINAL_TARGET).click();
|
|
|
|
await expectTerminalTabOpen(page);
|
|
});
|
|
|
|
test("the pinned button is mirrored in the sidebar workspace row and launches a terminal in that workspace", async ({
|
|
page,
|
|
}) => {
|
|
test.setTimeout(45_000);
|
|
await gotoWorkspace(page, workspace.workspaceId);
|
|
await togglePinFromMenu(page, TERMINAL_TARGET);
|
|
|
|
await gotoAppShell(page);
|
|
const row = page.getByTestId(`sidebar-workspace-row-${getServerId()}:${workspace.workspaceId}`);
|
|
await expect(row).toBeVisible({ timeout: 30_000 });
|
|
await row.hover();
|
|
|
|
await expect(sidebarPin(page, TERMINAL_TARGET)).toBeVisible({ timeout: 10_000 });
|
|
await sidebarPin(page, TERMINAL_TARGET).click();
|
|
|
|
await expect(page).toHaveURL(/\/workspace\//, { timeout: 30_000 });
|
|
await expectTerminalTabOpen(page);
|
|
});
|
|
});
|