mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-05 16:04:43 +00:00
* fix(desktop): wait for Metro HTTP readiness before launching Electron Expo briefly listens while probing port availability. A successful TCP connection can therefore launch Electron before Metro starts and leave it exiting on connection refusal. Require the configured renderer origin to report the running packager status. * test(ci): consolidate fixture and readiness corrections Await the connection and UI states each journey owns, isolate Git fixture contents before observation, and hold real Markdown frames at asserted checkpoints. Keep creation completion diagnostics explicit without claiming the original Windows failure is fixed. * test(desktop): describe Metro readiness through HTTP states Keep protocol mechanics in the fixture and assert readiness only after a successful packager response. Cover non-success status and unrelated HTTP content without inline synchronization in the test body.
76 lines
2.9 KiB
TypeScript
76 lines
2.9 KiB
TypeScript
import { writeFileSync } from "node:fs";
|
|
import path from "node:path";
|
|
import { expect, type Locator, type Page } from "@playwright/test";
|
|
import { buildHostWorkspaceRoute } from "@/utils/host-routes";
|
|
import { openCommandCenter } from "./command-center";
|
|
import { expectAppRoute } from "./route-assertions";
|
|
import type { SeededWorkspace } from "./seed-client";
|
|
import { getServerId } from "./server-id";
|
|
import { expectTerminalTabOpen } from "./workspace-tabs";
|
|
|
|
function action(panel: Locator, title: string): Locator {
|
|
const escapedTitle = title.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
return panel.getByRole("button", { name: new RegExp(`^${escapedTitle}(?:\\s|$)`) });
|
|
}
|
|
|
|
export async function makeWorkspacePrimaryGitActionCommit(seeded: SeededWorkspace): Promise<void> {
|
|
writeFileSync(path.join(seeded.repoPath, "command-center-dirty.txt"), "dirty\n");
|
|
const refreshed = await seeded.client.checkoutRefresh(seeded.repoPath);
|
|
if (!refreshed.success) {
|
|
throw new Error(`Failed to refresh checkout: ${JSON.stringify(refreshed.error)}`);
|
|
}
|
|
}
|
|
|
|
export async function openWorkspaceFromCommandCenter(
|
|
page: Page,
|
|
seeded: SeededWorkspace,
|
|
title: string,
|
|
): Promise<void> {
|
|
const panel = await openCommandCenter(page);
|
|
await panel.getByTestId("command-center-input").fill(title);
|
|
await action(panel, title).click();
|
|
await expectAppRoute(page, buildHostWorkspaceRoute(getServerId(), seeded.workspaceId), {
|
|
timeout: 30_000,
|
|
});
|
|
}
|
|
|
|
export async function expectDefaultWorkspaceActions(panel: Locator): Promise<void> {
|
|
await expect(panel.getByText("Workspace actions", { exact: true })).toBeVisible({
|
|
timeout: 30_000,
|
|
});
|
|
await expect(action(panel, "New agent")).toBeVisible();
|
|
await expect(action(panel, "Commit")).toBeVisible();
|
|
await expect(action(panel, "Push")).toHaveCount(0);
|
|
await expect(action(panel, "New terminal")).toHaveCount(0);
|
|
await expect(action(panel, "Split pane right")).toHaveCount(0);
|
|
await expect(action(panel, "Home")).toHaveCount(0);
|
|
await expect(action(panel, "Add project")).toHaveCount(0);
|
|
}
|
|
|
|
export async function expectWorkspaceActionsAvailableThroughSearch(panel: Locator): Promise<void> {
|
|
const input = panel.getByTestId("command-center-input");
|
|
await input.fill("push");
|
|
await expect(action(panel, "Push")).toBeVisible();
|
|
|
|
await input.fill("home");
|
|
await expect(action(panel, "Home")).toBeVisible();
|
|
|
|
await input.fill("git");
|
|
await expect.poll(() => panel.getByRole("button").count()).toBeGreaterThan(1);
|
|
}
|
|
|
|
export async function createTerminalFromCommandCenter(page: Page, panel: Locator): Promise<void> {
|
|
await panel.getByTestId("command-center-input").fill("terminal");
|
|
await page.keyboard.press("Enter");
|
|
await expectTerminalTabOpen(page);
|
|
}
|
|
|
|
export async function runWorkspaceActionFromCommandCenter(
|
|
page: Page,
|
|
title: string,
|
|
): Promise<void> {
|
|
const panel = await openCommandCenter(page);
|
|
await panel.getByTestId("command-center-input").fill(title);
|
|
await action(panel, title).click();
|
|
}
|