diff --git a/desktop/src/features/agents/ui/UnifiedAgentsSection.tsx b/desktop/src/features/agents/ui/UnifiedAgentsSection.tsx index aaeac68bb4..5811c43fde 100644 --- a/desktop/src/features/agents/ui/UnifiedAgentsSection.tsx +++ b/desktop/src/features/agents/ui/UnifiedAgentsSection.tsx @@ -370,7 +370,11 @@ function AgentPersonaCard({ ) } avatarUrl={avatarUrl} - dataTestId={`persona-agent-row-${persona.id}`} + dataTestId={ + agent + ? `managed-agent-${agent.pubkey}` + : `persona-agent-row-${persona.id}` + } identityLabel={agent ? truncatePubkey(agent.pubkey) : null} label={title} modelLabel={modelLabel} diff --git a/desktop/tests/e2e/agent-lifecycle-feedback.spec.ts b/desktop/tests/e2e/agent-lifecycle-feedback.spec.ts index de94bb230f..d8b5a11473 100644 --- a/desktop/tests/e2e/agent-lifecycle-feedback.spec.ts +++ b/desktop/tests/e2e/agent-lifecycle-feedback.spec.ts @@ -106,9 +106,9 @@ test.describe("agent lifecycle feedback screenshots", () => { await openAgentsView(page); - // The custom persona card appears in the library. + // The running instance is visible and owns the persona actions menu. await expect( - page.getByText("Cascade Test Agent", { exact: true }), + page.getByTestId(`managed-agent-${CASCADE_AGENT_B_PUBKEY}`), ).toBeVisible({ timeout: 10_000 }); // Open the actions menu for the custom persona. The trigger button carries @@ -240,7 +240,7 @@ test.describe("agent lifecycle feedback screenshots", () => { await openAgentsView(page); await expect( - page.getByText("Cascade Test Agent", { exact: true }), + page.getByTestId(`managed-agent-${CASCADE_AGENT_A_PUBKEY}`), ).toBeVisible({ timeout: 10_000 }); await page diff --git a/desktop/tests/e2e/agents.spec.ts b/desktop/tests/e2e/agents.spec.ts index 41854a9802..0292ded689 100644 --- a/desktop/tests/e2e/agents.spec.ts +++ b/desktop/tests/e2e/agents.spec.ts @@ -248,10 +248,16 @@ test("Agents view keeps every managed instance that shares a persona visible", a await gotoApp(page); await page.getByTestId("open-agents-view").click(); - const cards = page.getByTestId(`persona-agent-row-${personaId}`); + const cards = page.locator( + `[data-testid="managed-agent-${firstPubkey}"], [data-testid="managed-agent-${secondPubkey}"]`, + ); await expect(cards).toHaveCount(2); - await expect(cards.nth(0)).toContainText("aaaaaaaa…aaaa"); - await expect(cards.nth(1)).toContainText("bbbbbbbb…bbbb"); + await expect(page.getByTestId(`managed-agent-${firstPubkey}`)).toContainText( + "aaaaaaaa…aaaa", + ); + await expect(page.getByTestId(`managed-agent-${secondPubkey}`)).toContainText( + "bbbbbbbb…bbbb", + ); await expect(page.getByLabel("Open actions for Fizz")).toHaveCount(1); }); @@ -2618,7 +2624,7 @@ test("start pill morphs into the running dot without remounting the avatar", asy await gotoApp(page); await page.getByTestId("open-agents-view").click(); - const card = page.getByTestId(`persona-agent-row-${personaId}`); + const card = page.getByTestId(`managed-agent-${pubkey}`); const startButton = page.getByTestId(`agent-runtime-start-${pubkey}`); const badge = startButton.locator("xpath=../.."); const initialAvatar = await card @@ -2684,7 +2690,7 @@ test("start pill morphs into the running dot without remounting the avatar", asy ).toBe(true); }); -test("duplicate instances move from the agents gallery into the agent profile", async ({ +test("duplicate instances stay visible in the gallery and agent profile", async ({ page, }) => { const personaId = "custom:duplicate-auditor"; @@ -2719,10 +2725,9 @@ test("duplicate instances move from the agents gallery into the agent profile", await expect(page.getByText("Additional running agents")).toHaveCount(0); await expect( page.getByTestId(`managed-agent-${additionalPubkey}`), - ).toHaveCount(0); + ).toBeVisible(); - await page.getByTestId(`persona-agent-row-${personaId}`).click(); - await page.getByTestId("user-profile-tab-runtime").click(); + await page.getByTestId(`managed-agent-${primaryPubkey}`).click(); await page.getByTestId("user-profile-instances").click(); await page.getByTestId(`user-profile-instance-${additionalPubkey}`).click();