const { chromium } = require('playwright');
(async () => {
  const b = await chromium.launch();
  const p = await b.newPage({ viewport: { width: 1200, height: 2200 } });
  // portada
  await p.goto('http://localhost:8081/', { waitUntil: 'networkidle' });
  // primer avatar (Fray Marcos suele estar entre los primeros). Capturamos rejilla.
  const grid = await p.$('.fea-grid, .fea-section');
  await p.screenshot({ path: '/tmp/shot_portada.png', fullPage: true });
  // recorte de cada card avatar
  const avs = await p.$$('.fea-card-avatar');
  let i = 0;
  for (const a of avs.slice(0, 12)) {
    await a.screenshot({ path: `/tmp/av_${i}.png` }).catch(()=>{});
    i++;
  }
  console.log('avatars capturados:', i);
  await b.close();
})();
