дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-05 17:47:08 +02:00
* fix(remote-dev): show remote project loading inside its new tab * fix(remote-dev): preserve active remote session on cancel and style grouped Welcome tabs
62 рядки
2.8 KiB
TypeScript
62 рядки
2.8 KiB
TypeScript
import { expect, test } from "./fixtures";
|
|
|
|
test("remote project opening stays inside its project tab with progress and Cancel", async ({ workbench: page }) => {
|
|
await page.evaluate(async () => {
|
|
const projectMod = "/src/platform/project.ts";
|
|
const remoteMod = "/src/platform/remote.ts";
|
|
const windowGroupsMod = "/src/platform/windowGroups.ts";
|
|
const { useProject } = await import(/* @vite-ignore */ projectMod);
|
|
const { useRemoteProgress } = await import(/* @vite-ignore */ remoteMod);
|
|
const { useWindowGroup } = await import(/* @vite-ignore */ windowGroupsMod);
|
|
const location = "ssh://[email protected]/Users/mac/repo/idea";
|
|
useWindowGroup.setState({
|
|
tabs: [
|
|
{ label: "main", name: "idea", root: "/Users/me/idea", current: false },
|
|
{ label: "project-1", name: "opengui", root: "/Users/me/opengui", current: false },
|
|
{
|
|
label: "project-2",
|
|
name: "idea",
|
|
root: location,
|
|
current: true,
|
|
remoteHost: "[email protected]",
|
|
},
|
|
],
|
|
});
|
|
useProject.setState({ project: null, opening: true, openingPath: location });
|
|
useRemoteProgress.setState({
|
|
location,
|
|
progress: { stage: "uploading", fraction: 0.68 },
|
|
});
|
|
});
|
|
|
|
const opening = page.locator("[data-project-opening]");
|
|
await expect(opening).toBeVisible();
|
|
await expect(opening.getByText("Welcome to OpenIDEA")).toHaveCount(0);
|
|
await expect(opening.getByRole("button", { name: "idea", exact: true })).toBeVisible();
|
|
await expect(opening.locator('[data-project-tab="project-1"]')).toBeVisible();
|
|
await expect(opening.locator('[data-project-tab="project-2"]')).toBeVisible();
|
|
await expect(opening.getByText("Opening idea…")).toBeVisible();
|
|
await expect(opening.getByText("Installing the IDE backend on the host… 68%")).toBeVisible();
|
|
await expect(opening.getByText("SSH: [email protected] — /Users/mac/repo/idea")).toBeVisible();
|
|
|
|
const bar = opening.getByRole("progressbar");
|
|
await expect(bar).toHaveAttribute("aria-valuenow", "68");
|
|
const fillWidthRatio = await bar.evaluate((el) => {
|
|
const track = el.getBoundingClientRect().width;
|
|
const fill = el.firstElementChild?.getBoundingClientRect().width ?? 0;
|
|
return track > 0 ? fill / track : 0;
|
|
});
|
|
expect(fillWidthRatio).toBeGreaterThan(0.6);
|
|
expect(fillWidthRatio).toBeLessThan(0.75);
|
|
|
|
// Verify opening body stays within viewport at the minimum window width (400px).
|
|
await page.setViewportSize({ width: 400, height: 500 });
|
|
const status = opening.getByRole("status");
|
|
const overflow = await status.evaluate((el) => el.scrollWidth > el.clientWidth + 1);
|
|
expect(overflow).toBe(false);
|
|
|
|
// Clicking Cancel clears the opening state.
|
|
await opening.getByRole("button", { name: "Cancel" }).click();
|
|
await expect(opening).toHaveCount(0);
|
|
});
|