From a016260763bde8ac7ca3193b309503d87174cb08 Mon Sep 17 00:00:00 2001 From: Dotta Date: Sun, 8 Nov 2026 03:48:57 -0600 Subject: [PATCH] test(evals): type the API key name after the agent page settles on its urlKey route Opening an agent page by id replaces the route with the agent's urlKey and remounts the key form, so a name typed before the swap was lost and the key was created as Default. Wait for the canonical route and confirm the field kept the name before pressing Create. Co-Authored-By: Claude Opus 5.5 --- .../runtime-private-key-worker.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/runner-e2e/chat-catalog-domains/runtime-private-key-worker.ts b/tests/runner-e2e/chat-catalog-domains/runtime-private-key-worker.ts index 346c0f2d00e..88ad73951b9 100644 --- a/tests/runner-e2e/chat-catalog-domains/runtime-private-key-worker.ts +++ b/tests/runner-e2e/chat-catalog-domains/runtime-private-key-worker.ts @@ -29,8 +29,17 @@ async function main(): Promise { return receipt; } if (![input.agentId, input.companyId, input.sourceIssueId].every(id => typeof id === "string" && /^[a-f0-9-]{36}$/i.test(id)) || !input.profileURL || new URL(input.profileURL).origin !== base.origin) throw new Error("Invalid exact private key resource binding"); + // The profile replaces an id route with the agent's urlKey and remounts the key form, which drops a name typed before then. + const { urlKey } = await json<{ urlKey: string }>(`/api/agents/${input.agentId}`); await page.goto(input.profileURL, { waitUntil: "domcontentloaded" }); - await page.getByPlaceholder("Key name (e.g. production)").fill("local integration"); await page.getByRole("button", { name: "Create", exact: true }).click(); + await page.waitForURL(url => url.pathname.split("/").map(decodeURIComponent).join("/").endsWith(`/agents/${urlKey}/api-keys`)); + const keyName = page.getByPlaceholder("Key name (e.g. production)"); + for (let attempt = 1; ; attempt++) { + await keyName.fill("local integration"); await page.waitForTimeout(750); + if (await keyName.inputValue() === "local integration") break; + if (attempt >= 5) throw new Error("Key name input did not keep its value"); + } + await page.getByRole("button", { name: "Create", exact: true }).click(); await page.getByText("API key created — copy it now, it will not be shown again.", { exact: true }).waitFor({ state: "visible" }); const token = (await page.locator("code").filter({ hasText: /^pcp_/ }).first().textContent())?.trim(); if (!token || token.length < 20) throw new Error("Missing private one-time credential");