spb/countryatlas
Public
TypeScript 57%
Python 38.6%
JavaScript 3.6%
CSS 0.6%
1import { chromium } from '/Users/simon-pierreboucher/Desktop/uqo-eval/node_modules/playwright/index.mjs';2const BASE = process.argv[2] ?? 'http://localhost:8290';3const OUT = new URL('./screens/compare-rankings/seg/', import.meta.url).pathname;4import { mkdirSync } from 'node:fs'; mkdirSync(OUT, { recursive: true });5const SHOTS = [6 ['cmp-snapshot', '/compare/canada/united-states/france', 390, [0, 700]],7 ['cmp-economy', '/compare/canada/united-states/france?tab=economy', 390, [0, 900, 1800]],8 ['cmp-hero', '/compare/canada/united-states/france?tab=economy&indicator=gdp-per-capita&from=1990&mode=index100', 390, [0, 700]],9 ['cmp-economy', '/compare/canada/united-states/france?tab=economy', 1280, [0, 900, 1800]],10 ['cmp-hero', '/compare/canada/united-states/france?tab=economy&indicator=gdp-per-capita&from=1990&mode=index100', 1280, [0]],11 ['rankings', '/rankings', 390, [0, 800]],12 ['rankings', '/rankings', 1280, [0, 900]],13 ['rk-gdppc', '/rankings/gdp-per-capita', 390, [0, 800, 2600, 3600]],14 ['rk-gdppc', '/rankings/gdp-per-capita', 1280, [900, 1800]],15 ['rk-life-oecd', '/rankings/life-expectancy?group=oecd', 390, [0, 1200]],16 ['rk-life-oecd', '/rankings/life-expectancy?group=oecd', 1280, [0, 1600]],17];18const b = await chromium.launch();19for (const [name, path, w, offsets] of SHOTS) {20 const mobile = w < 768;21 const ctx = await b.newContext({ viewport: { width: w, height: mobile ? 844 : 900 }, isMobile: mobile, hasTouch: mobile, deviceScaleFactor: 1 });22 const pg = await ctx.newPage();23 await pg.goto(BASE + path, { waitUntil: 'networkidle' });24 await pg.waitForTimeout(600);25 for (const y of offsets) {26 await pg.evaluate((yy) => window.scrollTo(0, yy), y);27 await pg.waitForTimeout(700);28 await pg.screenshot({ path: `${OUT}${name}-${w}-y${y}.png` });29 }30 await ctx.close();31}32await b.close();33console.log('done');34