c094eb88fa
Adds src/ (scripts, raw measurement logs, derived data, report source), tests/, LICENSE (MIT, code) and LICENSE-DATA.md (CC BY 4.0 for the survey's data; third-party terms). The report is updated to the current site; the v1 and v2 data hand-off files are unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
25 lines
2.0 KiB
JavaScript
25 lines
2.0 KiB
JavaScript
// Load the public site in a browser at desktop and phone size: no errors, counts equal the hand-off data file.
|
|
import { chromium } from 'playwright-core';
|
|
import fs from 'fs';
|
|
import { PAGE, HAND } from './paths.mjs';
|
|
const URL_ = process.env.SITE || 'https://pingstats.aethercosmology.com/';
|
|
const d = JSON.parse(fs.readFileSync(HAND('cable_latency_survey_data_v2.json'), 'utf8'));
|
|
const b = await chromium.launch({ executablePath: process.env.CH });
|
|
const errs = [];
|
|
for (const [w, h] of [[1440, 900], [390, 844]]) {
|
|
const p = await b.newPage({ viewport: { width: w, height: h } });
|
|
p.on('pageerror', e => errs.push(`${w}: ${e.message}`)); p.on('console', m => { if (m.type() === 'error') errs.push(`${w}: ${m.text()}`) });
|
|
const res = await p.goto(URL_, { waitUntil: 'networkidle' }); await p.waitForTimeout(1500);
|
|
const r = await p.evaluate(() => ({ routes: LP.length, ae: [liveBad('ae'), liveVac('ae')], sw: document.documentElement.scrollWidth, fonts: [...document.fonts].filter(f => f.status === 'loaded').map(f => f.family).filter((x, i, a) => a.indexOf(x) === i) }));
|
|
const f = d.summary.all_live.cable_route.ae;
|
|
const out = {};
|
|
for (const [src, key] of [['ours', 'vultr'], ['gp', 'globalping'], ['home', 'home']]) { await p.selectOption('#srcsel', src); await p.waitForTimeout(150);
|
|
out[src] = await p.evaluate(() => [LP.length, liveBad('ae'), liveVac('ae')]);
|
|
const s = d.summary[key]; if (out[src][0] !== s.routes || out[src][1] !== s.cable_route.ae.impossible_total || out[src][2] !== s.cable_route.ae.beats_vacuum) errs.push(`${w} ${src} mismatch ${out[src]}`) }
|
|
await p.selectOption('#srcsel', 'all'); await p.waitForTimeout(400);
|
|
await p.screenshot({ path: `out/live_${w}.png` });
|
|
console.log(w, res.status(), JSON.stringify(r), JSON.stringify(out), r.routes === d.summary.all_live.routes && r.ae[0] === f.impossible_total && r.ae[1] === f.beats_vacuum && r.sw === w ? 'ok' : 'MISMATCH');
|
|
await p.close();
|
|
}
|
|
console.log('ERRORS', JSON.stringify(errs)); await b.close();
|