Oregami
Repositories/oxedyne/daimond

oxedyne/daimond/dev/probe_turns.mjs

1.5 KiB, 1 run

created by r2519314175:91, which is this file's identity for as long as the history lasts, whatever it is later renamed to

download · who wrote it · its history

1// A ruler, not a test: what the turn controls actually measure in the page.
2import { open, chat, shot } from './harness.mjs';
3
4const s = await open({ name: 'probe-turns' });
5const p = s.page;
6await chat(s, '@text hello there');
7await chat(s, '@text and again, at slightly greater length so the thread has some height');
8
9const r = () => p.evaluate(() => {
10 const box = el => { const b = el.getBoundingClientRect(); return { w: Math.round(b.width), h: Math.round(b.height), top: Math.round(b.top) }; };
11 const head = document.querySelector('.panel.ai .chead');
12 const title = document.getElementById('current-session-name');
13 const tick = document.querySelector('.turn-pick');
14 return {
15 inputH: box(document.getElementById('chat-input')).h,
16 sendH: box(document.getElementById('chat-send')).h,
17 jumpH: box(document.getElementById('chat-jump')).h,
18 sendTop: box(document.getElementById('chat-send')).top,
19 inputTop: box(document.getElementById('chat-input')).top,
20 headOverflow: head.scrollWidth - head.clientWidth,
21 titleW: title ? box(title).w : 0,
22 titleText: title ? title.textContent : '',
23 titleTruncated: title ? title.scrollWidth > title.clientWidth + 1 : null,
24 tickW: tick ? box(tick).w : 0,
25 selecting: document.getElementById('collapse-btn').classList.contains('on'),
26 };
27});
28
29console.log('normal ', JSON.stringify(await r()));
30await p.evaluate(() => document.getElementById('collapse-btn').click());
31await p.waitForTimeout(300);
32console.log('selecting', JSON.stringify(await r()));
33await shot(s, 'turns-probe');
34await s.close();