← back to Rentv Tour
growth-cap.mjs
33 lines
import { chromium } from 'playwright';
import fs from 'fs';
// Growth act (Act I) — scroll-capture the /consulting growth-strategy deck into distinct frames.
const BASE = 'https://rentv.agentabrams.com';
const VW = 1440, VH = 810;
const pad = (n) => String(n).padStart(2, '0');
fs.mkdirSync('frames/growth', { recursive: true });
const browser = await chromium.launch();
const ctx = await browser.newContext({ viewport: { width: VW, height: VH }, httpCredentials: { username: 'admin', password: 'DW2024!' }, deviceScaleFactor: 2 });
const page = await ctx.newPage();
await page.goto(BASE + '/consulting', { waitUntil: 'networkidle', timeout: 30000 });
await page.waitForTimeout(1500);
// total scroll height → grab evenly-spaced sections as the Growth frames
const total = await page.evaluate(() => document.body.scrollHeight);
const LABELS = ['Growth Strategy', 'The Opportunity', 'Audience First', 'Deal + Conference Engine', 'Every Page, Graded', 'The Play'];
const N = LABELS.length;
const manifest = [];
for (let i = 0; i < N; i++) {
const y = Math.round((total - VH) * (i / (N - 1)));
await page.evaluate((yy) => window.scrollTo(0, yy), y);
await page.waitForTimeout(600);
const file = `frames/growth/${pad(i)}-growth.png`;
await page.screenshot({ path: file });
manifest.push({ i, route: '/consulting', label: LABELS[i], role: 'admin', status: 200, file });
console.log(` [growth] ${pad(i)} y=${y} -> ${LABELS[i]}`);
}
await browser.close();
fs.writeFileSync('frames/growth-manifest.json', JSON.stringify(manifest, null, 2));
console.log(`DONE: ${manifest.length} growth frames (page height ${total}px)`);