Files
paseo/packages/app/e2e/support/helpers/command-center-agent-controls.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

96 lines
3.1 KiB
TypeScript

import { expect, type Page } from "@playwright/test";
import type { SeededWorkspace } from "./seed-client";
import { openCommandCenter } from "./command-center";
export interface CommandCenterAgentControlChoice {
query: string;
choice: string;
}
export async function chooseCommandCenterAgentControl(input: {
page: Page;
query: string;
choice: string;
}): Promise<void> {
const panel = input.page.getByTestId("command-center-panel");
await panel.getByRole("textbox").fill(input.query);
const choice = panel.getByRole("button", { name: input.choice });
await expect(choice).toBeVisible({ timeout: 30_000 });
await choice.click();
}
export async function expectCommandCenterAgentControlSelected(input: {
page: Page;
query: string;
choice: string;
}): Promise<void> {
const panel = input.page.getByTestId("command-center-panel");
await panel.getByRole("textbox").fill(input.query);
const choice = panel.getByRole("button", { name: input.choice });
await expect(choice).toHaveRole("button");
await expect(choice).toHaveAttribute("aria-pressed", "true");
}
export async function applyCommandCenterAgentControls(
page: Page,
choices: readonly CommandCenterAgentControlChoice[],
): Promise<void> {
for (const choice of choices) {
await openCommandCenter(page);
await chooseCommandCenterAgentControl({ page, ...choice });
}
}
export async function expectFocusedAgentControls(
page: Page,
choices: readonly CommandCenterAgentControlChoice[],
): Promise<void> {
await openCommandCenter(page);
for (const choice of choices) {
await expectCommandCenterAgentControlSelected({ page, ...choice });
}
}
export async function submitDraftAgent(page: Page, prompt: string): Promise<void> {
const composer = page.getByRole("textbox", { name: "Message agent..." }).first();
await expect(composer).toBeEditable({ timeout: 30_000 });
await composer.fill(prompt);
await composer.press("Enter");
await expect(page.getByText(prompt, { exact: true }).first()).toBeVisible({ timeout: 30_000 });
}
export async function waitForDraftComposer(page: Page): Promise<void> {
await expect(page.getByRole("textbox", { name: "Message agent..." }).first()).toBeEditable({
timeout: 30_000,
});
}
export async function expectWorkspaceAgentConfiguration(
workspace: Pick<SeededWorkspace, "client" | "workspaceId">,
expected: { id?: string; provider: string; model: string | null; modeId: string | null },
): Promise<void> {
await expect
.poll(
async () => {
const entries = (await workspace.client.fetchAgents({ scope: "active" })).entries;
const agent = entries
.map((entry) => entry.agent)
.find(
(candidate) =>
candidate.workspaceId === workspace.workspaceId &&
(expected.id === undefined || candidate.id === expected.id),
);
return agent
? {
id: agent.id,
provider: agent.provider,
model: agent.model,
modeId: agent.currentModeId,
}
: null;
},
{ timeout: 30_000 },
)
.toMatchObject(expected);
}