Keep pane profiling compatible with native chat row labels

This commit is contained in:
2026-11-06 22:27:46 +00:00
parent 8eb3a44d56
commit 8e82c599b9
+18 -1
View File
@@ -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.