The room layout is accepted by measurement. drive.mjs renders named states of the room preview in a Chrome that listens for remote debugging and records the edges of each main element; align.mjs checks the grid; compare.mjs compares a run with reference-edges.json, the settled prototype. With it: the integrated shell at945db7f4is not accepted, two tests fail on that line aftercef99882, and the voice shortcut proposal is revised.
6 lines
805 B
JavaScript
6 lines
805 B
JavaScript
// usage: CLICK("name", index) — clicks visible element whose accessible name equals or starts with name
|
|
window.__click = (n, i = 0, exact = false) => { const name = e => (e.getAttribute('aria-label') || e.getAttribute('title') || e.innerText || '').replace(/\s+/g, ' ').trim();
|
|
const all = [...document.querySelectorAll('button,a[href],[role=button],[role=menuitem],[role=menuitemradio],[role=menuitemcheckbox],[role=tab],[role=option],label,summary')].filter(e => { const r = e.getBoundingClientRect(); return r.width > 0 && r.height > 0; });
|
|
const m = all.filter(e => exact ? name(e) === n : name(e) === n || name(e).startsWith(n));
|
|
if (!m[i]) return 'NOTFOUND ' + n + ' (' + m.length + ')'; m[i].scrollIntoView({block:'nearest'}); m[i].click(); return 'clicked ' + name(m[i]).slice(0, 40); };
|