oxedyne/daimond/dev/probe_skillsau3.mjs
2.5 KiB, 1 run
created by r2519314175:81, 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 | import { open } from './harness.mjs'; |
| 2 | const s = await open({ name: 'skillsau3', defaults: false }); |
| 3 | const { page } = s; |
| 4 | const msgs = []; |
| 5 | page.on('console', m => msgs.push(m.type() + ': ' + m.text().slice(0, 200))); |
| 6 | page.on('pageerror', e => msgs.push('PAGEERROR: ' + String(e).slice(0, 200))); |
| 7 | await page.waitForTimeout(2500); |
| 8 | await page.evaluate(() => DaimondPanels.show('work')); |
| 9 | await page.waitForTimeout(1200); |
| 10 | const out = {}; |
| 11 | // Blank the file so the chip is in its empty state. |
| 12 | out.blanked = await page.evaluate(async () => { |
| 13 | const m = await import('/pkg/oxedyne_daimond.js'); |
| 14 | await m.store_write('DAIMOND.md', ''); |
| 15 | return String(await m.store_read('DAIMOND.md') || '').length; |
| 16 | }); |
| 17 | await page.reload(); await page.waitForTimeout(3000); |
| 18 | await page.evaluate(() => DaimondPanels.show('work')); |
| 19 | await page.waitForTimeout(1200); |
| 20 | out.chip = await page.evaluate(() => { |
| 21 | const e = document.getElementById('instructions-chip'); |
| 22 | return e ? { d: e.style.display, empty: e.getAttribute('data-empty') } : null; |
| 23 | }); |
| 24 | out.seedExported = await page.evaluate(async () => { |
| 25 | const m = await import('/pkg/oxedyne_daimond.js'); |
| 26 | return typeof m.instructions_seed === 'function' ? String(m.instructions_seed()).length : 'absent'; |
| 27 | }); |
| 28 | msgs.length = 0; |
| 29 | out.box = await page.evaluate(() => { |
| 30 | const e = document.getElementById('instructions-chip'); |
| 31 | if (!e) return null; |
| 32 | const r = e.getBoundingClientRect(); |
| 33 | return { w: r.width, h: r.height, x: r.x, y: r.y, onclick: typeof e.onclick, |
| 34 | panel: (e.closest('[id^=panel-]') || {}).id || null, |
| 35 | panelShown: (() => { const p = e.closest('[id^=panel-]'); return p ? getComputedStyle(p).display : null; })() }; |
| 36 | }); |
| 37 | // Dispatched on the element rather than at its coordinates: the reload above drops |
| 38 | // the session, so the unlock modal is over the page and intercepts a real pointer. |
| 39 | // What is under test is the chip's own handler. |
| 40 | await page.evaluate(() => document.getElementById('instructions-chip').click()); |
| 41 | await page.waitForTimeout(3000); |
| 42 | out.after = await page.evaluate(async () => { |
| 43 | const m = await import('/pkg/oxedyne_daimond.js'); |
| 44 | let bytes = 0; try { bytes = String(await m.store_read('DAIMOND.md') || '').length; } catch (e) {} |
| 45 | let ws = 0; try { ws = String(await m.read_file('DAIMOND.md') || '').length; } catch (e) { ws = 'read err'; } |
| 46 | const e = document.getElementById('instructions-chip'); |
| 47 | return { storeBytes: bytes, workspaceBytes: ws, empty: e && e.getAttribute('data-empty'), |
| 48 | editorOpen: /How to answer me/.test(document.body.innerText) }; |
| 49 | }); |
| 50 | out.console = msgs.slice(0, 12); |
| 51 | console.log(JSON.stringify(out, null, 1)); |
| 52 | await s.browser.close(); |