Some checks failed
Deploy Landing Page / build (push) Waiting to run
Deploy Landing Page / deploy (push) Blocked by required conditions
CI Pipeline / Code Quality & Typecheck (push) Successful in 3m3s
CI Pipeline / Test Suite (ubuntu-latest) (push) Successful in 1m5s
CI Pipeline / Build Validation (admin) (push) Successful in 1m22s
CI Pipeline / Test Suite (macos-latest) (push) Failing after 5s
CI Pipeline / Test Suite (windows-latest) (push) Failing after 2m6s
CI Pipeline / Build Validation (desktop) (push) Successful in 4m1s
75 lines
2.9 KiB
JavaScript
75 lines
2.9 KiB
JavaScript
// scripts/capture-official-site-live.js
|
|
const { chromium } = require('@playwright/test');
|
|
const path = require('path');
|
|
const fs = require('fs');
|
|
const http = require('http');
|
|
|
|
const OUTPUT_DIR = 'C:/Users/encep/.gemini/antigravity-cli/brain/3ab7ae82-5634-41d5-93a7-3c12c22503e2/screenshots/official_site';
|
|
|
|
function serveStatic(dir) {
|
|
return new Promise((resolve) => {
|
|
const server = http.createServer((req, res) => {
|
|
let reqPath = req.url.split('?')[0];
|
|
if (reqPath === '/' || reqPath === '') reqPath = '/index.html';
|
|
const filePath = path.join(dir, reqPath);
|
|
if (fs.existsSync(filePath) && fs.statSync(filePath).isFile()) {
|
|
const ext = path.extname(filePath).toLowerCase();
|
|
const mime = { '.html': 'text/html', '.js': 'application/javascript', '.css': 'text/css', '.svg': 'image/svg+xml' };
|
|
res.writeHead(200, { 'Content-Type': mime[ext] || 'application/octet-stream' });
|
|
fs.createReadStream(filePath).pipe(res);
|
|
} else {
|
|
res.writeHead(404);
|
|
res.end('Not Found: ' + reqPath);
|
|
}
|
|
});
|
|
server.listen(0, '127.0.0.1', () => {
|
|
resolve({ server, port: server.address().port });
|
|
});
|
|
});
|
|
}
|
|
|
|
async function capture() {
|
|
if (!fs.existsSync(OUTPUT_DIR)) fs.mkdirSync(OUTPUT_DIR, { recursive: true });
|
|
|
|
const siteDistDir = path.resolve(__dirname, '../site/dist');
|
|
const { server, port } = await serveStatic(siteDistDir);
|
|
const baseUrl = `http://127.0.0.1:${port}`;
|
|
|
|
const browser = await chromium.launch({ channel: 'msedge', headless: true });
|
|
const context = await browser.newContext({ viewport: { width: 1440, height: 960 }, deviceScaleFactor: 2 });
|
|
const page = await context.newPage();
|
|
|
|
console.log(`Loading official site on ${baseUrl}...`);
|
|
await page.goto(baseUrl, { waitUntil: 'networkidle' });
|
|
await page.waitForTimeout(1000);
|
|
|
|
// Capture Hero with updated CTA
|
|
const heroShot = path.join(OUTPUT_DIR, '01_official_site_hero.png');
|
|
await page.screenshot({ path: heroShot });
|
|
console.log('Saved:', heroShot);
|
|
|
|
// Scroll to Download section
|
|
console.log('Scrolling to #download section on official site...');
|
|
const downloadSection = page.locator('#download');
|
|
await downloadSection.scrollIntoViewIfNeeded();
|
|
await page.waitForTimeout(1500);
|
|
|
|
const dlShot = path.join(OUTPUT_DIR, '02_official_site_download_section.png');
|
|
await page.screenshot({ path: dlShot });
|
|
console.log('Saved:', dlShot);
|
|
|
|
// Scroll to Releases section
|
|
console.log('Scrolling to #releases section on official site...');
|
|
const releasesSection = page.locator('#releases');
|
|
await releasesSection.scrollIntoViewIfNeeded();
|
|
await page.waitForTimeout(1000);
|
|
|
|
const relShot = path.join(OUTPUT_DIR, '03_official_site_releases_section.png');
|
|
await page.screenshot({ path: relShot });
|
|
console.log('Saved:', relShot);
|
|
|
|
await browser.close();
|
|
server.close();
|
|
}
|
|
|
|
capture().catch(console.error);
|