Files
hanzo.ai/scripts/capture-checkout.mjs

54 lines
2.3 KiB
JavaScript

import { chromium } from '@playwright/test'
async function capture() {
const browser = await chromium.launch({ headless: true })
const context = await browser.newContext({
viewport: { width: 1440, height: 1000 },
deviceScaleFactor: 2,
})
const page = await context.newPage()
const artifactDir = '/Users/a/.gemini/antigravity-cli/brain/7d16021b-0586-4014-8bf4-d1b767be0cc9'
console.log('1. Capturing Header Programs Dropdown...')
await page.goto('http://localhost:3003/', { waitUntil: 'networkidle' })
await page.waitForTimeout(600)
// Hover over Programs & Degrees
const programsTrigger = page.locator('text=Programs & Degrees').first()
if (await programsTrigger.isVisible()) {
await programsTrigger.hover()
await page.waitForTimeout(600)
await page.screenshot({ path: `${artifactDir}/university_header_dropdown.png`, fullPage: false })
}
console.log('2. Capturing Checkout Step 1: Tuition Payment...')
await page.goto('http://localhost:3003/checkout/agentic-coding?coupon=STUDENT50', { waitUntil: 'networkidle' })
await page.waitForTimeout(1000)
await page.screenshot({ path: `${artifactDir}/checkout_step1_payment.png`, fullPage: false })
console.log('3. Proceeding to Step 2: Hanzo ID Account Setup...')
const payBtn = page.locator('button:has-text("Pay $")').first()
if (await payBtn.isVisible()) {
await payBtn.click()
await page.waitForTimeout(1500)
await page.screenshot({ path: `${artifactDir}/checkout_step2_hanzo_id.png`, fullPage: false })
}
console.log('4. Capturing Step 3: Terminal Sandbox Provisioning...')
const createIdBtn = page.locator('button:has-text("Create Hanzo ID")').first()
if (await createIdBtn.isVisible()) {
await createIdBtn.click()
await page.waitForTimeout(1000)
await page.screenshot({ path: `${artifactDir}/checkout_step3_provisioning.png`, fullPage: false })
}
console.log('5. Capturing Portal Enrolled Welcome View...')
await page.goto('http://localhost:3003/portal?enrolled=agentic-coding&student=alex&welcome=1', { waitUntil: 'networkidle' })
await page.waitForTimeout(1000)
await page.screenshot({ path: `${artifactDir}/checkout_step4_portal_welcome.png`, fullPage: false })
await browser.close()
console.log('Successfully captured all checkout flow artifacts!')
}
capture().catch(console.error)