Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
test(desktop): select A/B Hosts by their display name in the agent switcher
Alfredo Lopez7b7ee0afd33f
diff --git a/desktop-app/test/e2e-playwright/chat-open-ab.spec.ts b/desktop-app/test/e2e-playwright/chat-open-ab.spec.tsindex 949dbcd28..e0fc51957 100644--- a/desktop-app/test/e2e-playwright/chat-open-ab.spec.ts+++ b/desktop-app/test/e2e-playwright/chat-open-ab.spec.ts@@ -76,12 +76,12 @@ function isolatedPath(runDir: string, target: string): string {throw new Error(`Cache target escapes isolation through a symlink: ${target}`)return target}-async function openChat(page: Page, host: string, chat: Chat): Promise<number> {+async function openChat(page: Page, host: string, label: string, chat: Chat): Promise<number> {await page.getByRole('navigation', { name: 'Chat breadcrumb', exact: true }).getByRole('button', { name: 'Chat', exact: true }).click()- await openExactAgentChat(page, host)+ await openExactAgentChat(page, host, label)const more = page.getByRole('button', { name: 'Show more', exact: true })const loadMore = page.getByRole('button', { name: 'Load more', exact: true })const target = page.locator(agentRow(host, chat.id))@@ -291,6 +291,8 @@ if (}let app: ElectronApplication | undefinedlet page: Page+ // The agent switcher shows display names; the app falls back to the ref when none is set.+ let hostLabels: Record<string, string> = {}const runDir = testInfo.outputPath('electron-isolation')const close = async () => {if (app) {@@ -392,6 +394,15 @@ if (runDir,path.join(runDir, 'chats', scope.environmentKey, scope.userId))+ hostLabels = await page!.evaluate(+ async hosts => {+ const catalog = await window.clerum.access.refreshCatalog()+ return Object.fromEntries(+ hosts.map(host => [host, catalog.agentDisplayByName?.[host] ?? host])+ )+ },+ [...HOSTS]+ )report.catalogs = await page!.evaluate(async hosts => {const catalogs: Catalog[] = []@@ -503,7 +514,7 @@ if (.toBe(true)})for (const chat of catalog.chats) {- const ms = await openChat(page, catalog.host, chat)+ const ms = await openChat(page, catalog.host, hostLabels[catalog.host]!, chat)samples.push({round: id,build,@@ -529,7 +540,7 @@ if (}))}const selected = report.catalogs[0]!.chats[0]!- await openChat(page!, HOSTS[0], selected)+ await openChat(page!, HOSTS[0], hostLabels[HOSTS[0]]!, selected)await expect.poll(() => page!.evaluate(host => window.clerum.chat.getLastActive(host), HOSTS[0])).toBe(selected.id)@@ -565,7 +576,7 @@ if (await authenticated()await expect(page.locator(row(HOSTS[0], selected.id))).toBeVisible()await page.getByTestId('nav-chat').click()- await openChat(page, HOSTS[0], selected)+ await openChat(page, HOSTS[0], hostLabels[HOSTS[0]]!, selected)})(),])for (const sample of paint) samples.push({ round: id, build, ...sample })diff --git a/desktop-app/test/e2e-playwright/qa-recorder-helpers.ts b/desktop-app/test/e2e-playwright/qa-recorder-helpers.tsindex a6eec826e..ec2b47863 100644--- a/desktop-app/test/e2e-playwright/qa-recorder-helpers.ts+++ b/desktop-app/test/e2e-playwright/qa-recorder-helpers.ts@@ -281,8 +281,14 @@ export async function openAgentsPage(page: Page): Promise<void> {/*** Navigate to the exact agent named by hostRef and land on its chat composer.* Uses exact identity (no first-available fallback), per the recorder contract.+ * The UI shows the agent's display name; pass it as `label` when it differs+ * from hostRef.*/-export async function openExactAgentChat(page: Page, hostRef: string): Promise<void> {+export async function openExactAgentChat(+ page: Page,+ hostRef: string,+ label: string = hostRef+): Promise<void> {const settingsMenu = page.getByTestId('nav-settings-menu')if ((await settingsMenu.getAttribute('aria-expanded')) !== 'true') {await settingsMenu.click()@@ -293,7 +299,7 @@ export async function openExactAgentChat(page: Page, hostRef: string): Promise<vawait expect(agentsItem).toBeVisible({ timeout: 15_000 })await agentsItem.click()const chatInput = page.getByRole('textbox', { name: 'Agent message composer' })- const exactAgent = page.locator('.agents-table-row-clickable', { hasText: hostRef }).first()+ const exactAgent = page.locator('.agents-table-row-clickable', { hasText: label }).first()const emptyState = page.getByText('No agents available')await expect(chatInput.or(exactAgent).or(emptyState)).toBeVisible({ timeout: 20_000 })@@ -311,16 +317,16 @@ export async function openExactAgentChat(page: Page, hostRef: string): Promise<vif (!(await chatInput.isVisible().catch(() => false)) ||!(await switchAgent- .getByText(hostRef, { exact: true })+ .getByText(label, { exact: true }).isVisible().catch(() => false))) {await switchAgent.click()- await page.getByRole('menuitem', { name: hostRef, exact: true }).click()+ await page.getByRole('menuitem', { name: label, exact: true }).click()}await expect(chatInput).toBeVisible({ timeout: 20_000 })- await expect(switchAgent).toContainText(hostRef)+ await expect(switchAgent).toContainText(label)}/** Send a chat message and wait for a non-empty assistant response. */