Download app/tests/http-embedded.mjs from Mike0021/MiniCPM5-2B-WebGPU-Pi-HTTP: direct link, hf CLI and curl.
- Browser
- Download file 1.7 kB
-
https://huggingface.co/spaces/Mike0021/MiniCPM5-2B-WebGPU-Pi-HTTP/resolve/main/app/tests/http-embedded.mjs
- Command line
-
hf download hf://spaces/Mike0021/MiniCPM5-2B-WebGPU-Pi-HTTP/app/tests/http-embedded.mjs
-
curl -L -o http-embedded.mjs https://huggingface.co/spaces/Mike0021/MiniCPM5-2B-WebGPU-Pi-HTTP/resolve/main/app/tests/http-embedded.mjs
1.7 kB
| import { chromium } from 'playwright'; | |
| import fs from 'node:fs/promises'; | |
| const root = new URL('../..', import.meta.url).pathname; | |
| const result = { date: new Date().toISOString(), url: 'https://huggingface.co/spaces/Mike0021/MiniCPM5-2B-WebGPU-Pi-HTTP' }; | |
| const browser = await chromium.launch({ executablePath: '/usr/bin/chromium', headless: true }); | |
| try { | |
| const page = await browser.newPage(); | |
| await page.goto(result.url, { waitUntil: 'domcontentloaded' }); | |
| // A FrameLocator survives the Hub replacing/navigating its initial iframe. | |
| const app = page.frameLocator('iframe[src*="mike0021-minicpm5-2b-webgpu-pi-http.static.hf.space"]'); | |
| // Wait for event handlers/worker initialization, not merely the static HTML. | |
| await app.locator('#files button').first().waitFor(); | |
| await app.locator('body').evaluate(() => window.browserPi.ready); | |
| await app.locator('#command').fill('curl -fsS https://jsonplaceholder.typicode.com/todos/1 -o embedded.json && jq -r .title embedded.json'); | |
| await app.locator('#shell-run').click(); | |
| await app.locator('.shell-entry:last-child .shell-status.success').waitFor(); | |
| result.stdout = await app.locator('.shell-entry:last-child .shell-stdout').textContent(); | |
| result.storageNotice = await app.locator('#notice').textContent(); | |
| result.openInNewTabOffered = await app.locator('#open-tab').isVisible(); | |
| result.passed = result.stdout.includes('delectus aut autem'); | |
| console.log(JSON.stringify(result)); | |
| } catch (error) { result.failure = error.message; process.exitCode = 1; console.log('FAIL', error.message); } | |
| finally { await fs.writeFile(root + '/validation/http-embedded.json', JSON.stringify(result, null, 2) + '\n'); await browser.close(); } | |