test(vcs): verify the single-row Worktrees layout (#7588)

The Worktrees panel shows the folder, branch and path on one row, but the
layout spec still expected the folder above the branch and failed. It now
checks the three columns in order on one line, keeping the toolbar,
submodule and keyboard selection checks.

Co-authored-by: faysou <[email protected]>
Цей коміт міститься в:
faysouтаfaysou authored and GitHub committed 2026-12-03 01:37:04 +08:00
1 джерело 95d4a41b62
коміт 6eb1f0713d
1 file changed
+11 -2
+11 -2
Переглянути файл
@@ -1,6 +1,8 @@
import { expect, stubDesktop, test } from "./fixtures";
test("Worktrees places actions beside the tree and shows the folder above its branch", async ({ workbench: page }) => {
test("Worktrees places actions beside the tree and shows the folder, branch, and path on one row", async ({
workbench: page,
}) => {
await page.setViewportSize({ width: 1100, height: 700 });
await stubDesktop(page);
await page.evaluate(async () => {
@@ -42,9 +44,16 @@ test("Worktrees places actions beside the tree and shows the folder above its br
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 path = row.getByText("/dev/review-worktree", { exact: true });
await expect(path).toBeVisible();
const nameBox = (await name.boundingBox())!;
const branchBox = (await branch.boundingBox())!;
expect(nameBox.y + nameBox.height).toBeLessThanOrEqual(branchBox.y);
const pathBox = (await path.boundingBox())!;
expect(nameBox.x + nameBox.width).toBeLessThanOrEqual(branchBox.x);
expect(branchBox.x + branchBox.width).toBeLessThanOrEqual(pathBox.x);
for (const column of [branchBox, pathBox]) {
expect(column.y + column.height / 2).toBeCloseTo(nameBox.y + nameBox.height / 2, 0);
}
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/ });