const { chromium } = require('playwright');

(async () => {
  const browser = await chromium.launch();
  const page = await browser.newPage();

  // 设置视口大小
  await page.setViewportSize({ width: 1920, height: 1080 });

  // 导航到本地开发服务器
  await page.goto('http://localhost:8080');

  // 等待页面加载完成
  await page.waitForLoadState('networkidle');

  // 截取全屏
  await page.screenshot({
    path: 'homepage-full.png',
    fullPage: true
  });

  console.log('截图已保存为 homepage-full.png');

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