дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-23 18:10:45 +02:00
Improve OpenIDEA's Git workflows across commit and staging, branch and remote operations, merge and rebase, Git Log and signing, worktrees, stash and shelf, patch application, and clone settings. Adds a one-click stash for tracked changes across Git roots and lets users open a worktree branch's associated GitHub review from its context menu. Cloning now includes submodules by default (Settings › Version Control › Git, can be turned off). Repository entry points added here run in each repository's execution scope, so they use the project's own git executable.
63 рядки
3.0 KiB
TypeScript
63 рядки
3.0 KiB
TypeScript
import { expect, stubDesktop, test } from "./fixtures";
|
|
|
|
test("Worktrees places actions beside the tree and shows the folder above its branch", async ({ workbench: page }) => {
|
|
await page.setViewportSize({ width: 1100, height: 700 });
|
|
await stubDesktop(page);
|
|
await page.evaluate(async () => {
|
|
const root = "/dev/acme-api";
|
|
const service = `${root}/service`;
|
|
const worktree = (path: string, branch: string | null, main = false, locked = false) => ({
|
|
path,
|
|
branch,
|
|
head: "a1234567e312",
|
|
main,
|
|
locked,
|
|
prunable: false,
|
|
});
|
|
window.__ipc.handlers.vcs_worktrees = ({ repo }) =>
|
|
repo === service
|
|
? [worktree(service, "release", true), worktree("/dev/service-snapshot", null)].map((tree) => ({
|
|
...tree,
|
|
submodule: true,
|
|
}))
|
|
: [worktree(root, "main", true), worktree("/dev/review-worktree", "feature/review", false, true)];
|
|
const store = "/src/features/vcs/store.ts";
|
|
const { useVcs } = await import(/* @vite-ignore */ store);
|
|
useVcs.setState({ root, roots: [root, service], repo: root, available: true });
|
|
const context = "/src/platform/context.ts";
|
|
const { setContext } = await import(/* @vite-ignore */ context);
|
|
setContext("vcsAvailable", true);
|
|
const actions = "/src/platform/actions.ts";
|
|
const { executeAction } = await import(/* @vite-ignore */ actions);
|
|
await executeAction("vcs.worktrees");
|
|
});
|
|
|
|
const panel = page.getByRole("tabpanel", { name: "Worktrees", exact: true });
|
|
const toolbar = panel.getByRole("toolbar", { name: "Worktrees", exact: true });
|
|
const tree = panel.getByRole("tree", { name: "Worktrees", exact: true });
|
|
await expect(tree.getByText("feature/review", { exact: true })).toBeVisible();
|
|
const barBox = (await toolbar.boundingBox())!;
|
|
const treeBox = (await tree.boundingBox())!;
|
|
expect(barBox.x + barBox.width).toBeLessThanOrEqual(treeBox.x);
|
|
const row = tree.getByRole("treeitem", { name: /review-worktree.*feature\/review/ });
|
|
const name = row.getByText("review-worktree", { exact: true });
|
|
const branch = row.getByText("feature/review", { exact: true });
|
|
const nameBox = (await name.boundingBox())!;
|
|
const branchBox = (await branch.boundingBox())!;
|
|
expect(nameBox.y + nameBox.height).toBeLessThanOrEqual(branchBox.y);
|
|
await expect(name).toHaveCSS("font-size", await branch.evaluate((el) => getComputedStyle(el).fontSize));
|
|
await expect(row.getByRole("img", { name: "locked", exact: true })).toBeVisible();
|
|
const submodule = tree.getByRole("treeitem", { name: /service-snapshot.*a1234567/ });
|
|
await expect(submodule.getByText("Submodule", { exact: true })).toBeVisible();
|
|
await expect(row.getByText("Submodule", { exact: true })).toHaveCount(0);
|
|
|
|
await tree.focus();
|
|
await tree.press("End");
|
|
await tree.press("r");
|
|
await tree.press("e");
|
|
await tree.press("v");
|
|
await expect(row).toHaveAttribute("aria-selected", "true");
|
|
await tree.press("Escape");
|
|
await expect(row.getByText("/dev/review-worktree", { exact: true })).toBeVisible();
|
|
});
|