Files
hanzo.ai/scripts/capture-all-courses-certification.mjs

49 lines
2.2 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. Navigating to RL 101 (Reinforcement Learning) Coursework...')
await page.goto('http://localhost:3003/portal?enrolled=reinforcement-learning&student=sarah', { waitUntil: 'networkidle' })
await page.waitForTimeout(800)
await page.screenshot({ path: `${artifactDir}/portal_rl101_coursework.png`, fullPage: false })
console.log('2. Completing RL 101 Coursework and Defending Capstone...')
const defendBtn = page.locator('button:has-text("Defend Capstone")').first()
if (await defendBtn.isVisible()) {
await defendBtn.click()
await page.waitForTimeout(1600)
} else {
const credBtn = page.locator('button:has-text("Credential"), button:has-text("View Credential")').first()
if (await credBtn.isVisible()) {
await credBtn.click()
await page.waitForTimeout(600)
}
}
await page.screenshot({ path: `${artifactDir}/portal_rl101_certified_credential.png`, fullPage: false })
console.log('3. Navigating to SYS 103 (Systems Engineering) Coursework...')
await page.goto('http://localhost:3003/portal?enrolled=systems-engineering&student=marcus', { waitUntil: 'networkidle' })
await page.waitForTimeout(800)
await page.screenshot({ path: `${artifactDir}/portal_sys103_coursework.png`, fullPage: false })
console.log('4. Defending SYS 103 Capstone & Claiming HCAISE Credential...')
const sysCredBtn = page.locator('button:has-text("Preview Credential"), button:has-text("Claim")').first()
if (await sysCredBtn.isVisible()) {
await sysCredBtn.click()
await page.waitForTimeout(600)
await page.screenshot({ path: `${artifactDir}/portal_sys103_certified_credential.png`, fullPage: false })
}
await browser.close()
console.log('Successfully captured all courses & certification verification!')
}
capture().catch(console.error)