Spaces:
Running
Running
Delete test_diag.js
Browse files123456789101112131415161718192021222324252627282930const puppeteer = require('puppeteer');const path = require('path');const fs = require('fs');// reuse AUTO from e2econst src = fs.readFileSync(path.resolve(__dirname, 'test_e2e.js'), 'utf8');const AUTO = src.match(/const AUTO = `([\s\S]*?)`;/)[1];
(async () => { const browser = await puppeteer.launch({ headless: 'new', args: ['--no-sandbox','--use-gl=swiftshader','--enable-unsafe-swiftshader'] }); const page = await browser.newPage(); await page.setViewport({ width: 1280, height: 720 }); await page.goto('file://' + path.resolve(__dirname, 'index.html'), { waitUntil: 'domcontentloaded', timeout: 60000 }); await page.waitForFunction('typeof THREE !== "undefined" && typeof G !== "undefined"', { timeout: 20000 }); await page.evaluate(() => startRace()); await page.evaluate(AUTO); for (let i = 0; i < 110; i++) { await new Promise(r => setTimeout(r, 1000)); const s = await page.evaluate(() => { const p = G.player; return { t: +G.raceTime.toFixed(0), s: Math.round(p.s), d: p.d == null ? null : +p.d.toFixed(1), v: +(Math.hypot(p.vx, p.vz) * 3.6).toFixed(0), lap: p.lap, wall: p.d != null && Math.abs(p.d) > 10.0, hdg: +p.heading.toFixed(2) }; }); if (i % 3 === 0 || s.v < 60) console.log(JSON.stringify(s)); } await browser.close();})();test_diag.jsDeleted-30