mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-23 09:42:53 +00:00
test(app): wait for agent control rows before keying the Command Center
Two Command Center agent-control tests typed a query and pressed Enter or ArrowDown immediately. The agent's mode and model rows register after the panel opens, so on a slow runner the keys landed while only file search had matched and the mode never changed. The CI trace for the failure shows no Mode or Model rows at the moment of the key press. The tests now wait until both groups are listed, which keeps what they check: the best match wins, and a stale arrow-key selection is dropped.
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
||||
applyCommandCenterAgentControls,
|
||||
chooseCommandCenterAgentControl,
|
||||
openCommandCenterForAgent,
|
||||
searchAgentControls,
|
||||
expectCommandCenterAgentControlSelected,
|
||||
expectFocusedAgentControls,
|
||||
expectWorkspaceAgentConfiguration,
|
||||
@@ -111,8 +112,8 @@ test.describe("Command Center agent controls", () => {
|
||||
});
|
||||
try {
|
||||
await workspace.client.setAgentMode(workspace.agentId, "approval-test");
|
||||
const input = await openCommandCenterForAgent(page, workspace);
|
||||
await input.fill("load");
|
||||
await openCommandCenterForAgent(page, workspace);
|
||||
await searchAgentControls(page, "load");
|
||||
await page.keyboard.press("Enter");
|
||||
|
||||
await expectWorkspaceAgentConfiguration(workspace, {
|
||||
@@ -184,7 +185,7 @@ test.describe("Command Center agent controls", () => {
|
||||
try {
|
||||
await workspace.client.setAgentMode(workspace.agentId, "approval-test");
|
||||
const input = await openCommandCenterForAgent(page, workspace);
|
||||
await input.fill("loa");
|
||||
await searchAgentControls(page, "loa");
|
||||
// Moves the highlight onto a model row, which still matches after the next keystroke.
|
||||
await page.keyboard.press("ArrowDown");
|
||||
await input.fill("load");
|
||||
|
||||
@@ -22,6 +22,22 @@ export async function openCommandCenterForAgent(
|
||||
return panel.getByTestId("command-center-input");
|
||||
}
|
||||
|
||||
/**
|
||||
* Types a query that matches both the agent's modes and its models, and waits until rows from both
|
||||
* groups are listed. The agent's controls register after the panel opens; a key pressed before
|
||||
* then lands on whatever else matched, such as file search.
|
||||
*/
|
||||
export async function searchAgentControls(page: Page, query: string): Promise<void> {
|
||||
const panel = page.getByTestId("command-center-panel");
|
||||
await panel.getByTestId("command-center-input").fill(query);
|
||||
await expect(panel.getByRole("button", { name: /^Mode › / }).first()).toBeVisible({
|
||||
timeout: 30_000,
|
||||
});
|
||||
await expect(panel.getByRole("button", { name: /^Model › / }).first()).toBeVisible({
|
||||
timeout: 30_000,
|
||||
});
|
||||
}
|
||||
|
||||
export async function chooseCommandCenterAgentControl(input: {
|
||||
page: Page;
|
||||
query: string;
|
||||
|
||||
Reference in New Issue
Block a user