Download task_033/tests/validate_aaav_dynamic.js from Lego-X/UXInteract: direct link, hf CLI and curl.
- Browser
- Download file 1.5 kB
-
https://huggingface.co/datasets/Lego-X/UXInteract/resolve/main/task_033/tests/validate_aaav_dynamic.js
- Command line
-
hf download hf://datasets/Lego-X/UXInteract/task_033/tests/validate_aaav_dynamic.js
-
curl -L -o validate_aaav_dynamic.js https://huggingface.co/datasets/Lego-X/UXInteract/resolve/main/task_033/tests/validate_aaav_dynamic.js
1.5 kB
| const fs = require('fs'); | |
| const path = require('path'); | |
| const {pathToFileURL} = require('url'); | |
| const {chromium} = require('playwright'); | |
| (async () => { | |
| const browser = await chromium.launch({headless: true}); | |
| try { | |
| const page = await browser.newPage({viewport: {width: 1100, height: 760}}); | |
| const errors = []; | |
| page.on('pageerror', error => errors.push(error.message)); | |
| await page.goto(pathToFileURL(path.resolve('report.html')).href, {waitUntil: 'load'}); | |
| const displayed = await page.locator('img[src="mnist_samples.png"]').evaluateAll(images => images.some(image => { | |
| const box = image.getBoundingClientRect(); | |
| for (let node = image; node; node = node.parentElement) { | |
| const style = getComputedStyle(node); | |
| if (style.display === 'none' || style.visibility === 'hidden' || Number(style.opacity) === 0) return false; | |
| } | |
| return image.complete && image.naturalWidth === 40 && image.naturalHeight === 8 && box.width >= 200 && box.height >= 40 && Math.abs(box.width / box.height - 5) < 0.01; | |
| })); | |
| if (!displayed) throw new Error('source montage must actually load and be visible in the report'); | |
| if (errors.length) throw new Error(errors.join(' | ')); | |
| fs.mkdirSync('/logs/verifier/visual-audit', {recursive: true}); | |
| await page.screenshot({path: '/logs/verifier/visual-audit/mnist-report.png', fullPage: true}); | |
| } finally { | |
| await browser.close(); | |
| } | |
| })().catch(error => {console.error(error); process.exit(1);}); | |