* fix(ci): skip unrelated required checks cleanly Matrix jobs had to start no-op runners to preserve interpolated required-check names. Static named jobs let GitHub report genuine skipped conclusions while keeping those names stable. * fix(ci): gate changes to install patching script * fix(ci): route cross-package test contracts narrowly * fix(ci): keep routed contracts merge-blocking * fix(server): exclude nested test utilities from builds * fix(ci): cover app-owned native and browser domains * refactor(ci): align tests with runtime domains Own browser specs, desktop specs, and Electron-only app code by stable directories so PR routing does not depend on filename conventions. Keep desktop integration coverage inside the required desktop check. * fix(ci): keep routing and desktop suites isolated The routing regression must run before dependency installation, and desktop Vitest must not collect Playwright-owned specs. * fix(ci): isolate desktop e2e runtime * perf(test): isolate Playwright workers * perf(test): parallelize Playwright within specs * fix(test): keep Playwright file scheduling * fix(test): share dynamic Metro fixture * fix(test): preserve own-host restart fixtures * fix(ci): preserve routed contracts after rebase * Stabilize Playwright wheel-scroll assertions
126 lines
4.4 KiB
TypeScript
126 lines
4.4 KiB
TypeScript
import { test, expect, type Page } from "../support/fixtures";
|
|
import { clickNewTerminal, gotoWorkspace } from "../support/helpers/launcher";
|
|
import { renameModalInput, renameModalSubmit } from "../support/helpers/rename";
|
|
import { seedWorkspace, type SeededWorkspace } from "../support/helpers/seed-client";
|
|
|
|
async function fetchTerminalTitle(
|
|
workspace: SeededWorkspace,
|
|
terminalId: string,
|
|
): Promise<string | null> {
|
|
const result = await workspace.client.listTerminals(workspace.repoPath, undefined, {
|
|
workspaceId: workspace.workspaceId,
|
|
});
|
|
const terminal = result.terminals.find((entry) => entry.id === terminalId);
|
|
return terminal?.title ?? null;
|
|
}
|
|
|
|
async function waitForCreatedTerminalId(workspace: SeededWorkspace): Promise<string> {
|
|
await expect
|
|
.poll(
|
|
async () => {
|
|
const result = await workspace.client.listTerminals(workspace.repoPath, undefined, {
|
|
workspaceId: workspace.workspaceId,
|
|
});
|
|
return result.terminals.map((entry) => entry.id);
|
|
},
|
|
{ timeout: 30_000 },
|
|
)
|
|
.toHaveLength(1);
|
|
const result = await workspace.client.listTerminals(workspace.repoPath, undefined, {
|
|
workspaceId: workspace.workspaceId,
|
|
});
|
|
const terminal = result.terminals[0];
|
|
if (!terminal) {
|
|
throw new Error("Expected one created terminal");
|
|
}
|
|
return terminal.id;
|
|
}
|
|
|
|
async function cleanupTerminal(
|
|
workspace: SeededWorkspace,
|
|
terminalId: string | null,
|
|
): Promise<void> {
|
|
if (terminalId) {
|
|
await workspace.client.killTerminal(terminalId).catch(() => undefined);
|
|
}
|
|
await workspace.cleanup();
|
|
}
|
|
|
|
async function readClipboard(page: Page): Promise<string> {
|
|
return page.evaluate(() => navigator.clipboard.readText());
|
|
}
|
|
|
|
test.describe("Workspace terminal tab rename", () => {
|
|
test("right-click copy terminal id writes the terminal id to the clipboard", async ({
|
|
context,
|
|
page,
|
|
}) => {
|
|
test.setTimeout(60_000);
|
|
|
|
const workspace = await seedWorkspace({ repoPrefix: "workspace-terminal-copy-id-" });
|
|
let terminalId: string | null = null;
|
|
|
|
try {
|
|
await context.grantPermissions(["clipboard-read", "clipboard-write"]);
|
|
await gotoWorkspace(page, workspace.workspaceId);
|
|
await clickNewTerminal(page);
|
|
terminalId = await waitForCreatedTerminalId(workspace);
|
|
|
|
const tab = page.getByTestId(`workspace-tab-terminal_${terminalId}`).first();
|
|
await expect(tab).toBeVisible({ timeout: 15_000 });
|
|
|
|
await tab.click({ button: "right" });
|
|
const copyTerminalId = page.getByTestId(
|
|
`workspace-tab-context-terminal_${terminalId}-copy-terminal-id`,
|
|
);
|
|
await expect(copyTerminalId).toBeVisible({ timeout: 10_000 });
|
|
await copyTerminalId.click();
|
|
|
|
await expect.poll(() => readClipboard(page)).toBe(terminalId);
|
|
} finally {
|
|
await cleanupTerminal(workspace, terminalId);
|
|
}
|
|
});
|
|
|
|
test("right-click rename persists the terminal title and updates the tab label", async ({
|
|
page,
|
|
}) => {
|
|
test.setTimeout(60_000);
|
|
|
|
const workspace = await seedWorkspace({ repoPrefix: "workspace-terminal-rename-" });
|
|
let terminalId: string | null = null;
|
|
|
|
try {
|
|
await gotoWorkspace(page, workspace.workspaceId);
|
|
await clickNewTerminal(page);
|
|
terminalId = await waitForCreatedTerminalId(workspace);
|
|
|
|
const tab = page.getByTestId(`workspace-tab-terminal_${terminalId}`).first();
|
|
await expect(tab).toBeVisible({ timeout: 15_000 });
|
|
|
|
await tab.click({ button: "right" });
|
|
await expect(page.getByTestId(`workspace-tab-context-terminal_${terminalId}`)).toBeVisible({
|
|
timeout: 10_000,
|
|
});
|
|
const renameItem = page.getByTestId(`workspace-tab-context-terminal_${terminalId}-rename`);
|
|
await expect(renameItem).toBeVisible({ timeout: 10_000 });
|
|
await renameItem.click();
|
|
|
|
const modalPrefix = `workspace-tab-rename-modal-terminal-${terminalId}`;
|
|
const input = renameModalInput(page, modalPrefix);
|
|
await expect(input).toBeVisible({ timeout: 10_000 });
|
|
|
|
await input.fill("My Renamed Terminal");
|
|
await renameModalSubmit(page, modalPrefix).click();
|
|
|
|
await expect(input).toHaveCount(0, { timeout: 15_000 });
|
|
await expect(tab).toContainText("My Renamed Terminal", { timeout: 15_000 });
|
|
await expect
|
|
.poll(() => fetchTerminalTitle(workspace, terminalId!))
|
|
.toBe("My Renamed Terminal");
|
|
} finally {
|
|
await cleanupTerminal(workspace, terminalId);
|
|
}
|
|
});
|
|
});
|