// Toggle Cable routes / Straight lines on every map and record what the page shows. import { chromium } from 'playwright-core'; import { PAGE, HAND } from './paths.mjs'; const b = await chromium.launch({ executablePath: process.env.CH }); const p = await b.newPage({ viewport: { width: 1440, height: 900 } }); await p.goto(PAGE('site/index.html')); await p.waitForTimeout(1500); for (const v of ['ae', 'dp', 'merc']) { await p.click(`.models button[data-v="${v}"]`); await p.waitForTimeout(1200); for (const mode of ['cable', 'line']) { await p.click(`#mode button[data-mode="${mode}"]`); await p.waitForTimeout(900); const r = await p.evaluate(() => ({ big: document.getElementById('rbig').textContent, lab: document.getElementById('rlab').innerText.replace(/\s+/g, ' ').slice(0, 120), card: [...document.querySelectorAll('#card .row .top')].map(e => e.innerText.replace(/\s+/g, ' ')).join(' | '), score: [...document.querySelectorAll('#score tbody tr')].map(r => r.cells[1].innerText.replace(/\s+/g, ' ')).join(' / '), tab: document.querySelector('#card .tabs button[data-t="list"]').textContent })); console.log(v, mode, JSON.stringify(r)); } await p.click(`#mode button[data-mode="cable"]`); } await p.click('#mode button[data-mode="line"]'); await p.waitForTimeout(1500); await p.screenshot({ path: 'out/mode_line.png' }); await b.close();