Some checks are pending
CI Pipeline / Code Quality & Typecheck (push) Waiting to run
CI Pipeline / Test Suite (macos-latest) (push) Blocked by required conditions
CI Pipeline / Test Suite (ubuntu-latest) (push) Blocked by required conditions
CI Pipeline / Test Suite (windows-latest) (push) Blocked by required conditions
CI Pipeline / Build Validation (admin) (push) Blocked by required conditions
CI Pipeline / Build Validation (desktop) (push) Blocked by required conditions
Deploy Landing Page / build (push) Waiting to run
Deploy Landing Page / deploy (push) Blocked by required conditions
61 lines
2.3 KiB
JavaScript
61 lines
2.3 KiB
JavaScript
// scripts/capture-download-and-release-hub.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/download_center';
|
|
|
|
function serveStatic(dir) {
|
|
return new Promise((resolve) => {
|
|
const server = http.createServer((req, res) => {
|
|
let reqPath = req.url.split('?')[0];
|
|
if (reqPath === '/' || reqPath === '') reqPath = '/download.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');
|
|
}
|
|
});
|
|
server.listen(0, '127.0.0.1', () => {
|
|
const port = server.address().port;
|
|
resolve({ server, port });
|
|
});
|
|
});
|
|
}
|
|
|
|
async function capture() {
|
|
if (!fs.existsSync(OUTPUT_DIR)) fs.mkdirSync(OUTPUT_DIR, { recursive: true });
|
|
|
|
const sitePublicDir = path.resolve(__dirname, '../site/public');
|
|
const { server, port } = await serveStatic(sitePublicDir);
|
|
|
|
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(`Navigating to http://127.0.0.1:${port}/download.html...`);
|
|
await page.goto(`http://127.0.0.1:${port}/download.html`, { waitUntil: 'networkidle' });
|
|
await page.waitForTimeout(1500);
|
|
|
|
const shot1 = path.join(OUTPUT_DIR, '01_download_center_hero_desktop.png');
|
|
await page.screenshot({ path: shot1, fullPage: false });
|
|
console.log('Saved:', shot1);
|
|
|
|
const shotFull = path.join(OUTPUT_DIR, '02_download_center_full_page.png');
|
|
await page.screenshot({ path: shotFull, fullPage: true });
|
|
console.log('Saved:', shotFull);
|
|
|
|
await browser.close();
|
|
server.close();
|
|
}
|
|
|
|
capture().catch(console.error);
|