Files
paseo/packages/app/e2e/support/helpers/command-center-workspace-actions.ts
T
Mohamed BoudraandGitHub 5a30affd7f Skip unrelated required checks without losing their names (#2542)
* fix(ci): skip unrelated required checks cleanly

Matrix jobs had to start no-op runners to preserve interpolated required-check names. Static named jobs let GitHub report genuine skipped conclusions while keeping those names stable.

* fix(ci): gate changes to install patching script

* fix(ci): route cross-package test contracts narrowly

* fix(ci): keep routed contracts merge-blocking

* fix(server): exclude nested test utilities from builds

* fix(ci): cover app-owned native and browser domains

* refactor(ci): align tests with runtime domains

Own browser specs, desktop specs, and Electron-only app code by stable directories so PR routing does not depend on filename conventions. Keep desktop integration coverage inside the required desktop check.

* fix(ci): keep routing and desktop suites isolated

The routing regression must run before dependency installation, and desktop Vitest must not collect Playwright-owned specs.

* fix(ci): isolate desktop e2e runtime

* perf(test): isolate Playwright workers

* perf(test): parallelize Playwright within specs

* fix(test): keep Playwright file scheduling

* fix(test): share dynamic Metro fixture

* fix(test): preserve own-host restart fixtures

* fix(ci): preserve routed contracts after rebase

* Stabilize Playwright wheel-scroll assertions
2026-08-02 00:56:05 +08:00

67 lines
2.7 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 page.keyboard.press("Enter");
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);
}