From 8cc11b759313da202844bcad94bb3563397ef13f Mon Sep 17 00:00:00 2001 From: Dotta Date: Sat, 7 Nov 2026 13:54:05 -0600 Subject: [PATCH] test(evals): identify an opened agent profile by its header portrait Since #19535 the agent profile h1 is the editable title ("Frontend engineer"), and the name is secondary text. The runtime result check waited for a heading named "Morgan" and failed on the correct page in run 42406653921. Identify the profile by the header portrait, which the page labels " avatar". Co-Authored-By: Claude Opus 5.5 --- .../chat-catalog-domains/runtime-support.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/runner-e2e/chat-catalog-domains/runtime-support.ts b/tests/runner-e2e/chat-catalog-domains/runtime-support.ts index e784f5b46d3..ebda865d8cc 100644 --- a/tests/runner-e2e/chat-catalog-domains/runtime-support.ts +++ b/tests/runner-e2e/chat-catalog-domains/runtime-support.ts @@ -59,7 +59,15 @@ export async function openRuntimeAgentProfile(ctx: ChatCatalogContext, agent: Ru const href = o && agentLink(o, agent); if (href) await ctx.input.page.locator(`[id^="comment-"] a[href=${JSON.stringify(href)}]`).first().click(); else await ctx.input.page.goto(`/${ctx.input.fixtures.company.issuePrefix}/agents/${agent.id}`, { waitUntil: "domcontentloaded" }); - await expect(ctx.input.page.getByRole("heading", { name: agent.name!, exact: true }).first()).toBeVisible(); + await expect(agentProfileIdentity(ctx.input.page, agent)).toBeVisible(); +} +/** + * The profile header's h1 is the agent's editable title (falling back to its + * role), and the name is secondary text. The header portrait carries the + * name as " avatar", so it identifies whose profile is open. + */ +export function agentProfileIdentity(page: Page, agent: RuntimeAgent) { + return page.locator("header").getByRole("img", { name: `${agent.name} avatar`, exact: true }).first(); } export async function verifyRuntimeResult(ctx: ChatCatalogContext, state: Record, value: unknown) { const o = runtimeObservation(value); if (!o) throw new Error("Missing independent runtime result"); @@ -68,7 +76,7 @@ export async function verifyRuntimeResult(ctx: ChatCatalogContext, state: Record const source = ctx.input.page.url(); await openRuntimeAgentProfile(ctx, target, o); await ctx.input.page.reload({ waitUntil: "domcontentloaded" }); - await expect(ctx.input.page.getByRole("heading", { name: target.name!, exact: true }).first()).toBeVisible(); + await expect(agentProfileIdentity(ctx.input.page, target)).toBeVisible(); await ctx.input.evidence("chat-catalog-runtime-profile-opened.json", { agentId: target.id, companyId: target.companyId, url: ctx.input.page.url() }); await ctx.input.page.goto(source, { waitUntil: "domcontentloaded" }); }