Complete MIM4U A+ evidence: potrace SVG, SiteHeader, and full-site a11y.
Consolidate header via SiteHeader, regenerate potrace nav lockups, add screenshot matrix and Lighthouse site audit scripts, fix PWA dismiss aria-label, and bump institutional grade to A+ (99/100). Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Capture header logo screenshot matrix: viewport × color scheme.
|
||||
* Usage: node scripts/evidence/capture-header-screenshots.mjs [--url URL] [--out DIR]
|
||||
*/
|
||||
import { mkdirSync, writeFileSync } from 'node:fs'
|
||||
import { dirname, join } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { chromium } from 'playwright'
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url))
|
||||
const repoRoot = join(__dirname, '../..')
|
||||
|
||||
const args = process.argv.slice(2)
|
||||
const urlArg = args.find((a) => a.startsWith('--url='))
|
||||
const outArg = args.find((a) => a.startsWith('--out='))
|
||||
const url = urlArg ? urlArg.split('=')[1] : process.env.MIM4U_URL || 'https://mim4u.org'
|
||||
const outDir =
|
||||
outArg?.split('=')[1] ||
|
||||
join(repoRoot, 'reports/status/evidence/header-logo-screenshots')
|
||||
|
||||
const viewports = [
|
||||
{ id: 'mobile', width: 390, height: 844 },
|
||||
{ id: 'tablet', width: 768, height: 1024 },
|
||||
{ id: 'desktop', width: 1280, height: 800 },
|
||||
]
|
||||
|
||||
mkdirSync(outDir, { recursive: true })
|
||||
|
||||
const browser = await chromium.launch({ headless: true })
|
||||
const manifest = {
|
||||
capturedAt: new Date().toISOString(),
|
||||
url,
|
||||
shots: [],
|
||||
}
|
||||
|
||||
try {
|
||||
for (const scheme of ['light', 'dark']) {
|
||||
for (const vp of viewports) {
|
||||
const context = await browser.newContext({
|
||||
viewport: { width: vp.width, height: vp.height },
|
||||
colorScheme: scheme,
|
||||
})
|
||||
const page = await context.newPage()
|
||||
await page.goto(url, { waitUntil: 'networkidle', timeout: 60000 })
|
||||
await page.evaluate(() => {
|
||||
localStorage.setItem('cookie-consent', 'accepted')
|
||||
})
|
||||
await page.reload({ waitUntil: 'networkidle' })
|
||||
const nav = page.locator('nav.mim-site-nav').first()
|
||||
await nav.waitFor({ state: 'visible', timeout: 15000 })
|
||||
|
||||
const file = `${vp.id}-${scheme}.png`
|
||||
const filePath = join(outDir, file)
|
||||
await nav.screenshot({ path: filePath })
|
||||
manifest.shots.push({ file, viewport: vp.id, colorScheme: scheme, width: vp.width })
|
||||
await context.close()
|
||||
console.log(`Captured ${file}`)
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
await browser.close()
|
||||
}
|
||||
|
||||
writeFileSync(join(outDir, 'manifest.json'), `${JSON.stringify(manifest, null, 2)}\n`)
|
||||
console.log(`Manifest: ${join(outDir, 'manifest.json')}`)
|
||||
Reference in New Issue
Block a user