test(desktop): align agent instance selectors

Co-authored-by: Atish Patel <atish@squareup.com>
Signed-off-by: Atish Patel <atish@squareup.com>
Signed-off-by: Brainy Bumble <0ed7657b57c0e8a9f5288390dd6c8d5d0a3a06abe9b01b9006814f52077d6cdf@buzz.block.builderlab.xyz>
This commit is contained in:
Brainy Bumble
2026-08-11 12:03:49 -05:00
parent 0e365660a3
commit 7954ff8367
3 changed files with 21 additions and 12 deletions

View File

@@ -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}

View File

@@ -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

View File

@@ -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();