From 7d43e452e1fc1710ea06f62abced4e7421348c96 Mon Sep 17 00:00:00 2001 From: klopez4212 Date: Thu, 25 Jun 2026 14:49:06 +0100 Subject: [PATCH] Update mesh compute test for profile sidebar --- desktop/tests/e2e/mesh-compute.spec.ts | 32 +++++++++++++++----------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/desktop/tests/e2e/mesh-compute.spec.ts b/desktop/tests/e2e/mesh-compute.spec.ts index 05ba8e0f2..2f3385ba3 100644 --- a/desktop/tests/e2e/mesh-compute.spec.ts +++ b/desktop/tests/e2e/mesh-compute.spec.ts @@ -64,15 +64,22 @@ async function setMesh( }, mesh); } -async function openManagedAgentActions( +async function openManagedAgentProfile( page: import("@playwright/test").Page, pubkey: string, ) { - const trigger = page.getByTestId(`managed-agent-actions-${pubkey}`); - await trigger.scrollIntoViewIfNeeded(); - await trigger.focus(); - await trigger.press("Enter"); - await expect(trigger).toHaveAttribute("data-state", "open"); + const row = page.getByTestId(`managed-agent-${pubkey}`); + await row.getByRole("button", { name: "Manage" }).click(); + await expect(page.getByTestId("user-profile-panel")).toBeVisible(); +} + +async function clickManagedAgentPrimaryAction( + page: import("@playwright/test").Page, + label: string, +) { + const action = page.getByTestId("user-profile-agent-primary-action"); + await expect(action).toContainText(label); + await action.click(); } async function openNewAgentMenu(page: import("@playwright/test").Page) { @@ -330,8 +337,8 @@ test("saved relay-mesh agents restart via the backend serve-target preflight", a 0, ); - await openManagedAgentActions(page, pubkey); - await page.getByRole("menuitem", { name: "Stop" }).click(); + await openManagedAgentProfile(page, pubkey); + await clickManagedAgentPrimaryAction(page, "Stop"); await expect .poll(async () => await commands(page)) .toContain("stop_managed_agent"); @@ -339,22 +346,19 @@ test("saved relay-mesh agents restart via the backend serve-target preflight", a // With a live serve target for the model, manual restart goes through: // the backend preflight re-resolves the target and the agent starts. - await openManagedAgentActions(page, pubkey); - await page.getByRole("menuitem", { name: "Spawn" }).click(); + await clickManagedAgentPrimaryAction(page, "Respawn"); await expect .poll(async () => await commands(page)) .toContain("start_managed_agent"); await expect(row).toContainText("running"); - await openManagedAgentActions(page, pubkey); - await page.getByRole("menuitem", { name: "Stop" }).click(); + await clickManagedAgentPrimaryAction(page, "Stop"); await expect(row).toContainText("stopped"); // Without a live serve target, the backend preflight rejects the start // with an actionable error, surfaced as a toast; the agent stays stopped. await setMesh(page, { models: [] }); - await openManagedAgentActions(page, pubkey); - await page.getByRole("menuitem", { name: "Spawn" }).click(); + await clickManagedAgentPrimaryAction(page, "Respawn"); await expect( page