Spaces:
Running
Running
Delete test_diag.js
Browse files- test_diag.js +0 -30
test_diag.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
| 1 |
-
const puppeteer = require('puppeteer');
|
| 2 |
-
const path = require('path');
|
| 3 |
-
const fs = require('fs');
|
| 4 |
-
// reuse AUTO from e2e
|
| 5 |
-
const src = fs.readFileSync(path.resolve(__dirname, 'test_e2e.js'), 'utf8');
|
| 6 |
-
const AUTO = src.match(/const AUTO = `([\s\S]*?)`;/)[1];
|
| 7 |
-
|
| 8 |
-
(async () => {
|
| 9 |
-
const browser = await puppeteer.launch({ headless: 'new',
|
| 10 |
-
args: ['--no-sandbox','--use-gl=swiftshader','--enable-unsafe-swiftshader'] });
|
| 11 |
-
const page = await browser.newPage();
|
| 12 |
-
await page.setViewport({ width: 1280, height: 720 });
|
| 13 |
-
await page.goto('file://' + path.resolve(__dirname, 'index.html'),
|
| 14 |
-
{ waitUntil: 'domcontentloaded', timeout: 60000 });
|
| 15 |
-
await page.waitForFunction('typeof THREE !== "undefined" && typeof G !== "undefined"', { timeout: 20000 });
|
| 16 |
-
await page.evaluate(() => startRace());
|
| 17 |
-
await page.evaluate(AUTO);
|
| 18 |
-
for (let i = 0; i < 110; i++) {
|
| 19 |
-
await new Promise(r => setTimeout(r, 1000));
|
| 20 |
-
const s = await page.evaluate(() => {
|
| 21 |
-
const p = G.player;
|
| 22 |
-
return { t: +G.raceTime.toFixed(0), s: Math.round(p.s), d: p.d == null ? null : +p.d.toFixed(1),
|
| 23 |
-
v: +(Math.hypot(p.vx, p.vz) * 3.6).toFixed(0), lap: p.lap,
|
| 24 |
-
wall: p.d != null && Math.abs(p.d) > 10.0,
|
| 25 |
-
hdg: +p.heading.toFixed(2) };
|
| 26 |
-
});
|
| 27 |
-
if (i % 3 === 0 || s.v < 60) console.log(JSON.stringify(s));
|
| 28 |
-
}
|
| 29 |
-
await browser.close();
|
| 30 |
-
})();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|