exl100

Émulateur Exelvision EXL 100 (1984) dans le navigateur : dsp-cpp en WebAssembly, cartouches et cassettes BASIC
git clone https://git.schurger.org/exl100.git
Log | Files | Refs | README

programs.mjs (1488B)


      1 // Vérifie le menu « Programme » : compte les cartouches embarquées, puis en charge quelques-unes
      2 // (via le <select>) et capture l'écran de chacune.
      3 //   node test/programs.mjs [url] [préfixe]
      4 import { open, sleep } from './cdp.mjs';
      5 
      6 const url = process.argv[2] ?? 'http://localhost:8191/';
      7 const prefix = process.argv[3] ?? '/tmp/exl100-prog';
      8 
      9 const page = await open(url, { width: 900, height: 820 });
     10 await sleep(12000); // boot logo + FS prêt
     11 
     12 const opts = await page.evaluate(`Array.from(document.getElementById('program').options).map(o => o.value)`);
     13 const titles = await page.evaluate(`Array.from(document.getElementById('program').options).map(o => o.textContent)`);
     14 console.log('Programmes au menu :', opts.length - 1); // moins le logo
     15 console.log('Titres :', titles.slice(1).join(', '));
     16 
     17 async function boot(file, name, secs = 10) {
     18   await page.evaluate(`(() => { const s = document.getElementById('program'); s.value = ${JSON.stringify(file)}; s.dispatchEvent(new Event('change')); })()`);
     19   await sleep(secs * 1000);
     20   console.log(`${name} :`, await page.screenshot(`${prefix}-${name}.png`));
     21 }
     22 
     23 await boot('exelbasic.bin', 'exelbasic', 12);
     24 await boot('tennis.bin', 'tennis', 12);
     25 await boot('guppy.bin', 'guppy', 12);
     26 await boot('', 'logo', 8);
     27 
     28 for (const l of page.logs) console.log(l);
     29 page.close();
     30 const errored = page.logs.some((l) => /abort|uncaught|cannot load/i.test(l));
     31 if (opts.length < 10 || errored) { console.error('ÉCHEC'); process.exit(1); }