mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
test(app): align projects/vim e2e specs with current UI
- Navigate Projects via the settings sidebar entry; the top-level
Projects button never existed and the page lives under
/settings/projects.
- Match the row's accessibility label (Edit <project>) and the
textbox label (Worktree setup commands) the screen actually uses.
- Replace the .xterm-rows DOM selector with .xterm-screen for the
vim layout assertion. With the WebGL renderer, .xterm-rows > div
is empty, so the test has been red since it was added in 2b372765.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import { readFile } from "node:fs/promises";
|
import { readFile } from "node:fs/promises";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
import { expect, test as base, type Page } from "./fixtures";
|
import { expect, test as base, type Page } from "./fixtures";
|
||||||
import { gotoAppShell } from "./helpers/app";
|
import { gotoAppShell, openSettings } from "./helpers/app";
|
||||||
import { connectNewWorkspaceDaemonClient, openProjectViaDaemon } from "./helpers/new-workspace";
|
import { connectNewWorkspaceDaemonClient, openProjectViaDaemon } from "./helpers/new-workspace";
|
||||||
import { createTempGitRepo } from "./helpers/workspace";
|
import { createTempGitRepo } from "./helpers/workspace";
|
||||||
|
|
||||||
@@ -53,19 +53,22 @@ const test = base.extend<ProjectsSettingsFixtures>({
|
|||||||
|
|
||||||
async function openProjects(page: Page): Promise<void> {
|
async function openProjects(page: Page): Promise<void> {
|
||||||
await gotoAppShell(page);
|
await gotoAppShell(page);
|
||||||
await page.getByRole("button", { name: "Projects", exact: true }).click();
|
await openSettings(page);
|
||||||
await expect(page).toHaveURL(/\/projects$/);
|
await page.getByTestId("settings-projects").click();
|
||||||
|
await expect(page).toHaveURL(/\/settings\/projects$/);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function openProjectSettings(page: Page, projectName: string): Promise<void> {
|
async function openProjectSettings(page: Page, projectName: string): Promise<void> {
|
||||||
await page.getByRole("button", { name: `${projectName} project details` }).click();
|
await page.getByRole("button", { name: `Edit ${projectName}`, exact: true }).click();
|
||||||
await expect(page.getByRole("textbox", { name: "Worktree setup" })).toBeVisible({
|
await expect(page.getByRole("textbox", { name: "Worktree setup commands" })).toBeVisible({
|
||||||
timeout: 30_000,
|
timeout: 30_000,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function editWorktreeSetup(page: Page, setupCommands: string[]): Promise<void> {
|
async function editWorktreeSetup(page: Page, setupCommands: string[]): Promise<void> {
|
||||||
await page.getByRole("textbox", { name: "Worktree setup" }).fill(setupCommands.join("\n"));
|
await page
|
||||||
|
.getByRole("textbox", { name: "Worktree setup commands" })
|
||||||
|
.fill(setupCommands.join("\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
async function saveProjectConfig(page: Page): Promise<void> {
|
async function saveProjectConfig(page: Page): Promise<void> {
|
||||||
|
|||||||
@@ -31,12 +31,12 @@ async function readTerminalLayoutMetrics(page: Page): Promise<TerminalLayoutMetr
|
|||||||
return rect.width > 0 && rect.height > 0;
|
return rect.width > 0 && rect.height > 0;
|
||||||
});
|
});
|
||||||
const surface = visibleSurfaces[0] ?? null;
|
const surface = visibleSurfaces[0] ?? null;
|
||||||
const renderedRows = Array.from(document.querySelectorAll<HTMLElement>(".xterm-rows > div"));
|
|
||||||
const firstRow = renderedRows[0] ?? null;
|
|
||||||
const lastRow = renderedRows.at(-1) ?? null;
|
|
||||||
const surfaceRect = surface?.getBoundingClientRect() ?? null;
|
const surfaceRect = surface?.getBoundingClientRect() ?? null;
|
||||||
const firstRowRect = firstRow?.getBoundingClientRect() ?? null;
|
// xterm.js exposes `.xterm-screen` regardless of renderer (DOM, canvas, WebGL),
|
||||||
const lastRowRect = lastRow?.getBoundingClientRect() ?? null;
|
// so use it as the canonical "rendered surface" rect rather than `.xterm-rows`
|
||||||
|
// which is only populated by the DOM renderer.
|
||||||
|
const xtermScreen = surface?.querySelector<HTMLElement>(".xterm-screen") ?? null;
|
||||||
|
const xtermScreenRect = xtermScreen?.getBoundingClientRect() ?? null;
|
||||||
const term = (
|
const term = (
|
||||||
window as Window & {
|
window as Window & {
|
||||||
__paseoTerminal?: {
|
__paseoTerminal?: {
|
||||||
@@ -49,11 +49,10 @@ async function readTerminalLayoutMetrics(page: Page): Promise<TerminalLayoutMetr
|
|||||||
return {
|
return {
|
||||||
visibleSurfaceCount: visibleSurfaces.length,
|
visibleSurfaceCount: visibleSurfaces.length,
|
||||||
surfaceHeight: surfaceRect?.height ?? 0,
|
surfaceHeight: surfaceRect?.height ?? 0,
|
||||||
rowCount: renderedRows.length,
|
rowCount: typeof term?.rows === "number" ? term.rows : 0,
|
||||||
rows: typeof term?.rows === "number" ? term.rows : null,
|
rows: typeof term?.rows === "number" ? term.rows : null,
|
||||||
cols: typeof term?.cols === "number" ? term.cols : null,
|
cols: typeof term?.cols === "number" ? term.cols : null,
|
||||||
renderedRowsHeight:
|
renderedRowsHeight: xtermScreenRect?.height ?? 0,
|
||||||
firstRowRect && lastRowRect ? Math.max(0, lastRowRect.bottom - firstRowRect.top) : 0,
|
|
||||||
tabIds: currentTabIds,
|
tabIds: currentTabIds,
|
||||||
};
|
};
|
||||||
}, tabIds);
|
}, tabIds);
|
||||||
|
|||||||
Reference in New Issue
Block a user