const { chromium } = require('playwright');
(async () => {
  const browser = await chromium.launch({ headless: true });
  const page = await (await browser.newContext()).newPage();
  await page.goto('http://127.0.0.1:8099/', { waitUntil: 'load' });
  await page.waitForTimeout(3000);
  const data = await page.evaluate(async () => {
    const r = await fetch('https://api.minipos.us/v1/get-buy-service-info/pos/1?store_id=0');
    return JSON.stringify(await r.json());
  }).catch(e => 'ERR: ' + e.message);
  console.log('buy-service API:', data.slice(0, 600));
  await browser.close();
})();
