Skip to content

Commit 3250c8d

Browse files
npub14vtk7pvazqrq9639qu7e560wnqtl0d53ca4gjuvq6jzf3k2el23qqlwa7fMargetellaho
committed
test(e2e): drive agent lifecycle via profile sidebar primary action
The mesh-compute restart spec still drove the old per-row agent-actions dropdown (managed-agent-actions-<pubkey>), which PR #1200 removed in favor of a Manage button that opens the profile sidebar. Rewrite the helper (openManagedAgentActions -> triggerManagedAgentPrimaryAction) to click Manage and then the user-profile-agent-primary-action toggle, preserving the test's intent. Test-only; no product code changed. Co-authored-by: Marge <marge@users.noreply.github.com> Co-authored-by: Taylor Ho <taylorkmho@gmail.com> Signed-off-by: Taylor Ho <taylorkmho@gmail.com>
1 parent ffd84f6 commit 3250c8d

1 file changed

Lines changed: 19 additions & 14 deletions

File tree

desktop/tests/e2e/mesh-compute.spec.ts

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,24 @@ async function setMesh(
6464
}, mesh);
6565
}
6666

67-
async function openManagedAgentActions(
67+
async function triggerManagedAgentPrimaryAction(
6868
page: import("@playwright/test").Page,
6969
pubkey: string,
7070
) {
71-
const trigger = page.getByTestId(`managed-agent-actions-${pubkey}`);
72-
await trigger.scrollIntoViewIfNeeded();
73-
await trigger.focus();
74-
await trigger.press("Enter");
75-
await expect(trigger).toHaveAttribute("data-state", "open");
71+
// Agent lifecycle actions moved from the old per-row dropdown into the
72+
// profile sidebar (PR #1200): the Agents-page row now exposes a "Manage"
73+
// button that opens the profile panel, where a single primary-action button
74+
// toggles Stop (when running/deployed) / Start (when stopped). Open the panel
75+
// for this agent if it isn't already showing it, then click that toggle.
76+
const panel = page.getByTestId("user-profile-panel");
77+
const primaryAction = panel.getByTestId("user-profile-agent-primary-action");
78+
if (!(await primaryAction.isVisible().catch(() => false))) {
79+
const row = page.getByTestId(`managed-agent-${pubkey}`);
80+
await row.getByRole("button", { name: "Manage" }).click();
81+
await expect(panel).toBeVisible();
82+
}
83+
await expect(primaryAction).toBeEnabled();
84+
await primaryAction.click();
7685
}
7786

7887
async function openNewAgentMenu(page: import("@playwright/test").Page) {
@@ -330,31 +339,27 @@ test("saved relay-mesh agents restart via the backend serve-target preflight", a
330339
0,
331340
);
332341

333-
await openManagedAgentActions(page, pubkey);
334-
await page.getByRole("menuitem", { name: "Stop" }).click();
342+
await triggerManagedAgentPrimaryAction(page, pubkey);
335343
await expect
336344
.poll(async () => await commands(page))
337345
.toContain("stop_managed_agent");
338346
await expect(row).toContainText("stopped");
339347

340348
// With a live serve target for the model, manual restart goes through:
341349
// the backend preflight re-resolves the target and the agent starts.
342-
await openManagedAgentActions(page, pubkey);
343-
await page.getByRole("menuitem", { name: "Spawn" }).click();
350+
await triggerManagedAgentPrimaryAction(page, pubkey);
344351
await expect
345352
.poll(async () => await commands(page))
346353
.toContain("start_managed_agent");
347354
await expect(row).toContainText("running");
348355

349-
await openManagedAgentActions(page, pubkey);
350-
await page.getByRole("menuitem", { name: "Stop" }).click();
356+
await triggerManagedAgentPrimaryAction(page, pubkey);
351357
await expect(row).toContainText("stopped");
352358

353359
// Without a live serve target, the backend preflight rejects the start
354360
// with an actionable error, surfaced as a toast; the agent stays stopped.
355361
await setMesh(page, { models: [] });
356-
await openManagedAgentActions(page, pubkey);
357-
await page.getByRole("menuitem", { name: "Spawn" }).click();
362+
await triggerManagedAgentPrimaryAction(page, pubkey);
358363

359364
await expect(
360365
page

0 commit comments

Comments
 (0)