mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
Reanimated entering animations can leave the measured menu surface with an inline height. Release that fixed height after opening and when measured content changes so service rows can grow in place.
81 lines
2.8 KiB
TypeScript
81 lines
2.8 KiB
TypeScript
import { test, expect } from "./fixtures";
|
|
import { createTempGitRepo } from "./helpers/workspace";
|
|
import {
|
|
connectWorkspaceSetupClient,
|
|
createWorkspaceThroughDaemon,
|
|
openWorkspaceScriptsMenu,
|
|
seedProjectForWorkspaceSetup,
|
|
startWorkspaceScriptFromMenu,
|
|
waitForWorkspaceSetupProgress,
|
|
} from "./helpers/workspace-setup";
|
|
import { waitForWorkspaceTabsVisible } from "./helpers/workspace-tabs";
|
|
import { getServerId } from "./helpers/server-id";
|
|
import { buildHostWorkspaceRoute } from "../src/utils/host-routes";
|
|
|
|
test("scripts menu resizes when a service row grows after launch", async ({ page }) => {
|
|
const client = await connectWorkspaceSetupClient();
|
|
const repo = await createTempGitRepo("script-menu-resize-", {
|
|
paseoConfig: {
|
|
worktree: {
|
|
setup: ["sh -c 'echo setup complete'"],
|
|
},
|
|
scripts: {
|
|
web: {
|
|
type: "service",
|
|
command:
|
|
"node -e \"const http = require('http'); const s = http.createServer((q,r) => r.end('ok')); s.listen(process.env.PORT || 3000, () => console.log('listening on ' + s.address().port))\"",
|
|
},
|
|
},
|
|
},
|
|
});
|
|
|
|
try {
|
|
await seedProjectForWorkspaceSetup(client, repo.path);
|
|
const completed = waitForWorkspaceSetupProgress(
|
|
client,
|
|
(payload) => payload.status === "completed" && payload.detail.log.includes("setup complete"),
|
|
);
|
|
const workspace = await createWorkspaceThroughDaemon(client, {
|
|
cwd: repo.path,
|
|
worktreeSlug: `script-menu-resize-${Date.now()}`,
|
|
});
|
|
await completed;
|
|
|
|
await page.goto(buildHostWorkspaceRoute(getServerId(), workspace.id));
|
|
await waitForWorkspaceTabsVisible(page);
|
|
await openWorkspaceScriptsMenu(page);
|
|
|
|
const menu = page.getByTestId("workspace-scripts-menu");
|
|
const before = await menu.evaluate((element) => {
|
|
const rect = element.getBoundingClientRect();
|
|
return {
|
|
height: rect.height,
|
|
clientHeight: element.clientHeight,
|
|
scrollHeight: element.scrollHeight,
|
|
};
|
|
});
|
|
|
|
await startWorkspaceScriptFromMenu(page, "web");
|
|
await expect(menu).toContainText("localhost:", { timeout: 15_000 });
|
|
|
|
const after = await menu.evaluate((element) => {
|
|
const rect = element.getBoundingClientRect();
|
|
const firstChild = element.firstElementChild;
|
|
const childRect = firstChild?.getBoundingClientRect();
|
|
return {
|
|
height: rect.height,
|
|
clientHeight: element.clientHeight,
|
|
scrollHeight: element.scrollHeight,
|
|
childHeight: childRect?.height ?? 0,
|
|
};
|
|
});
|
|
|
|
expect(after.height).toBeGreaterThan(before.height);
|
|
expect(after.scrollHeight).toBeLessThanOrEqual(after.clientHeight + 1);
|
|
expect(after.childHeight).toBeGreaterThan(before.height);
|
|
} finally {
|
|
await client.close();
|
|
await repo.cleanup();
|
|
}
|
|
});
|