Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

2.1 KB
Raw Blame
// Capture real local outputs. Native projects must have been built independently.
import {mkdir,stat} from 'node:fs/promises';import {join} from 'node:path';import assert from 'node:assert/strict';
import {chromium,preview,root} from './helpers.mjs';import {build as quantumBuild} from '../../agents/quantum-studio/skills/quantum/scripts/build.mjs';
const browser=await(await chromium()).launch({headless:true,channel:process.env.PLAYWRIGHT_CHANNEL||undefined});
// Habitat now has a native server. Its real starter image is generated by
// store/agents/home-assistant/test/browser.mjs as hallway-starter.jpg.
const entries=[['web-studio','store/agents/web-studio/template','index.html'],['data-studio','store/agents/data-studio/template','index.html'],['quantum-studio','store/agents/quantum-studio/template','index.html'],['gis','store/agents/gis/template','index.html'],['godot-studio',process.env.GODOT_QA_WORKSPACE,'build/web/index.html'],['firmware-studio',process.env.FIRMWARE_QA_WORKSPACE,'build-status.html'],['orca-slicer',process.env.ORCA_QA_WORKSPACE,'preview.html'],['score',process.env.SCORE_QA_WORKSPACE,'score.html']];
try{for(const [id,template,file]of entries){if(!template){console.log('skip '+id+': provide its *_QA_WORKSPACE');continue;}
 const p=await preview(browser,template,{file,context:{viewport:{width:1600,height:1000}},prepare:id==='quantum-studio'?quantumBuild:undefined});
 try{const f=await p.open();await f.locator('body').waitFor();if(id==='godot-studio')await f.locator('#game-state[data-ready="true"]').waitFor({timeout:45000});if(id==='gis')await f.locator('.leaflet-interactive').first().waitFor();await p.page.waitForTimeout(800);await f.locator('body').evaluate(()=>window.scrollTo(0,0));assert.deepEqual(p.errors,[]);const directory=join(root,'store/showcase',id);await mkdir(directory,{recursive:true});const output=join(directory,'starter.jpg');await p.page.screenshot({path:output,type:'jpeg',quality:85});const size=(await stat(output)).size;assert.ok(size<350*1024,'Store image too large: '+id);console.log(id+': 1600×1000 JPEG, '+size+' bytes');}finally{await p.close();}
}}finally{await browser.close();}