#!/usr/bin/env node

const puppeteer = require('puppeteer');

function delay(time) {
  return new Promise(function (resolve) {
    setTimeout(resolve, time)
  });
}

(async () => {
  const browser = await puppeteer.launch({
    headless: "new",
    args: ['--no-sandbox'],
    defaultViewport: {
      width: 1920,
      height: 1080,
      isLandscape: true,
      deviceScaleFactor: 0.5
    }
  });

  const page = await browser.newPage();

  for (var i = 2; i < process.argv.length; i += 2) {
    await page.goto(process.argv[i], { waitUntil: 'networkidle2' });
    await delay(1000);
    await page.screenshot({ path: process.argv[i+1] });
  }

  await browser.close();
})();
