mirror of
https://github.com/hanzo-apps/hanzo.ai.git
synced 2026-10-28 07:32:52 +00:00
44 lines
1.8 KiB
JavaScript
44 lines
1.8 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()
|
|
|
|
console.log('Navigating to portal...')
|
|
await page.goto('http://localhost:3100/university/portal', { waitUntil: 'networkidle' })
|
|
await page.waitForTimeout(1000)
|
|
await page.screenshot({ path: '/Users/a/.gemini/antigravity-cli/brain/7d16021b-0586-4014-8bf4-d1b767be0cc9/portal_enrolled.png', fullPage: false })
|
|
|
|
console.log('Navigating to course page with coupon...')
|
|
await page.goto('http://localhost:3100/university/agentic-coding', { waitUntil: 'networkidle' })
|
|
await page.waitForTimeout(1000)
|
|
|
|
// Fill in coupon code
|
|
const couponInput = await page.locator('input[placeholder*="Coupon code"]').first()
|
|
if (await couponInput.isVisible()) {
|
|
await couponInput.fill('STUDENT50')
|
|
const applyBtn = await page.locator('button:has-text("Apply")').first()
|
|
await applyBtn.click()
|
|
await page.waitForTimeout(800)
|
|
}
|
|
await page.screenshot({ path: '/Users/a/.gemini/antigravity-cli/brain/7d16021b-0586-4014-8bf4-d1b767be0cc9/coupon_applied.png', fullPage: false })
|
|
|
|
console.log('Navigating to credential modal on portal...')
|
|
await page.goto('http://localhost:3100/university/portal', { waitUntil: 'networkidle' })
|
|
const credentialBtn = await page.locator('button:has-text("View Credential")').first()
|
|
if (await credentialBtn.isVisible()) {
|
|
await credentialBtn.click()
|
|
await page.waitForTimeout(600)
|
|
await page.screenshot({ path: '/Users/a/.gemini/antigravity-cli/brain/7d16021b-0586-4014-8bf4-d1b767be0cc9/credential_modal.png', fullPage: false })
|
|
}
|
|
|
|
await browser.close()
|
|
console.log('Done capturing screenshots!')
|
|
}
|
|
|
|
capture().catch(console.error)
|