// Orchestrator: starts the server and runs separated tests sequentially, // waiting for confirmation (ok: true) from the printer between steps. process.env.PRINTER_HOST = process.env.PRINTER_HOST || '192.168.87.147'; process.env.PRINTER_DEVICE_ID = process.env.PRINTER_DEVICE_ID || 'matricial2'; process.env.PRINTER_TIMEOUT_MS = process.env.PRINTER_TIMEOUT_MS || '60000'; process.env.PORT = process.env.PORT || '3001'; process.env.TEST_BASE_URL = process.env.TEST_BASE_URL || `http://localhost:${process.env.PORT}`; require('../src/server.js'); const sleep = (ms) => new Promise((r) => setTimeout(r, ms)); async function run() { const tests = [ require('./tests/01_text_simple'), require('./tests/02_align_cut'), require('./tests/03_font_size'), require('./tests/04_batch_feeds'), require('./tests/05_barcode'), require('./tests/06_qr'), require('./tests/07_pulse'), ]; await sleep(500); // give server time to bind for (let i = 0; i < tests.length; i++) { const fn = tests[i]; console.log(`\n>>> Running test ${i + 1}`); await fn(); await sleep(800); // small gap between prints } console.log('\nAll tests completed successfully.'); } run().catch((e) => { console.error(e); process.exit(1); });