mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-08 17:02:17 +00:00
Closes #1950 Plugins can declare `detail = true` on a tree or list view (any tool-window side, grouped or not) to show the selected item's detail-provider tabs beside the list. The pane follows selection and refresh, clears stale content when the item, project or remote host changes, shows an empty state when nothing is selected, and remembers its resizable divider. Services keeps its single split. Released WIT and IPC shapes are unchanged. Verified on macOS in light and dark themes. Co-authored-by: arnaud-ritti <[email protected]>
44 lines
2.6 KiB
TypeScript
44 lines
2.6 KiB
TypeScript
import { expect, test } from "@playwright/test";
|
|
|
|
test.use({ video: "on" });
|
|
|
|
for (const kind of ["tree", "list"]) {
|
|
test(`${kind} detail follows selection, refresh and removal and remembers a dragged divider`, async ({ page }) => {
|
|
await page.goto(`/e2e/pluginDetails.html?kind=${kind}`);
|
|
await page.getByText("alpha", { exact: true }).click();
|
|
await expect(page.locator("#root").getByRole("document")).toHaveText(`${kind}: alpha\nRevision 0`);
|
|
await page.getByRole("tab", { name: "Summary" }).click();
|
|
await expect(page.getByText("Selected alpha", { exact: true })).toBeVisible();
|
|
await page.getByText("beta", { exact: true }).click();
|
|
await expect(page.locator("#root").getByRole("document")).toContainText(`${kind}: beta`);
|
|
const handle = page.getByRole("separator");
|
|
const before = await handle.boundingBox();
|
|
expect(before).not.toBeNull();
|
|
await page.mouse.move(before!.x + before!.width / 2, before!.y + 50);
|
|
await page.mouse.down();
|
|
await page.mouse.move(before!.x + 150, before!.y + 50, { steps: 10 });
|
|
await page.mouse.up();
|
|
await expect.poll(async () => (await handle.boundingBox())!.x).toBeGreaterThan(before!.x + 100);
|
|
const dragged = (await handle.boundingBox())!.x;
|
|
await page.getByRole("button", { name: "Toggle view" }).click();
|
|
await page.getByRole("button", { name: "Toggle view" }).click();
|
|
await expect(handle).toBeVisible();
|
|
await expect.poll(async () => Math.abs((await handle.boundingBox())!.x - dragged)).toBeLessThan(2);
|
|
await page.getByText("alpha", { exact: true }).click();
|
|
await page.getByRole("button", { name: "Refresh details" }).click();
|
|
await expect(page.locator("#root").getByRole("document")).toContainText("Revision 1");
|
|
await page.getByRole("button", { name: "Switch remote host" }).click();
|
|
await expect(page.getByLabel("Remote host")).toHaveText("two");
|
|
await expect(page.getByText("Select an item to view details")).toBeVisible();
|
|
await expect(page.locator("#root").getByRole("document")).toHaveCount(0);
|
|
await page.getByText("alpha", { exact: true }).click();
|
|
await expect(page.locator("#root").getByRole("document")).toContainText(`${kind}: alpha`);
|
|
await page.getByRole("button", { name: "Remove alpha" }).click();
|
|
await expect(page.getByText("Select an item to view details")).toBeVisible();
|
|
await expect(page.locator("#root").getByRole("document")).toHaveCount(0);
|
|
await page.reload();
|
|
await expect(handle).toBeVisible();
|
|
await expect.poll(async () => Math.abs((await handle.boundingBox())!.x - dragged)).toBeLessThan(2);
|
|
});
|
|
}
|