diff --git a/app/tool/perf/chat_pane_bench.mjs b/app/tool/perf/chat_pane_bench.mjs index adca46e2..3415a8cd 100644 --- a/app/tool/perf/chat_pane_bench.mjs +++ b/app/tool/perf/chat_pane_bench.mjs @@ -39,6 +39,23 @@ const peekTarget = `eval:(() => { return [rect.x + rect.width / 2, rect.y + rect.height / 2]; })()`; +// Supports both the previous plain picker and the native rows' richer labels. +const secondChatTarget = `eval:(() => { + const nodes = [...document.querySelectorAll('flt-semantics, [aria-label]')]; + const hits = nodes.filter((element) => { + const label = element.getAttribute('aria-label') || element.innerText || ''; + const rect = element.getBoundingClientRect(); + return /Fixture chat 2(?:\\s|$)/.test(label) + && rect.width > 0 && rect.height > 0 && rect.top < innerHeight; + }).sort((a, b) => { + const ra = a.getBoundingClientRect(), rb = b.getBoundingClientRect(); + return ra.width * ra.height - rb.width * rb.height; + }); + if (!hits.length) return null; + const rect = hits[0].getBoundingClientRect(); + return [rect.x + rect.width / 2, rect.y + rect.height / 2]; +})()`; + await mkdir(options.out, { recursive: true }); const lookup = await loadSourceMap(options.build); const server = await serveBuild(options.build); @@ -78,7 +95,7 @@ try { await page.open(url.href, { width: 560, height: 1000, theme: 'light' }); await page.click('Add chat pane'); await delay(250); - await page.click('Fixture chat 2'); + await page.click(secondChatTarget); await delay(900); // Warm both retained transcripts before recording.