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.0 KB
Raw Blame
import {test} from 'node:test';import assert from 'node:assert/strict';import {cp,readFile} from 'node:fs/promises';import {chromium,preview} from './helpers.mjs';
test('real sliced G-code drives layer, stack, projection and download controls',{skip:!process.env.ORCA_QA_WORKSPACE},async()=>{
 const browser=await(await chromium()).launch({headless:true});const p=await preview(browser,null,{file:'preview.html',context:{viewport:{width:1600,height:1000}},prepare:async ws=>{for(const name of ['preview.html','part.gcode'])await cp(process.env.ORCA_QA_WORKSPACE+'/'+name,ws+'/'+name);}});
 try{const f=await p.open();await f.locator('#path[data-layer]').waitFor();const initial=Number(await f.locator('#path').getAttribute('data-segments'));await f.locator('#layer').fill('1');assert.equal(await f.locator('#path').getAttribute('data-layer'),'1');assert.ok(Number(await f.locator('#path').getAttribute('data-segments'))<initial);await f.locator('#next').click();assert.equal(await f.locator('#layer-label').textContent(),'2');await f.locator('#top').click();assert.equal(await f.locator('#path').getAttribute('data-projection'),'top');await f.locator('#iso').click();await f.locator('#layer').fill('168');await f.locator('#stack').uncheck();const single=Number(await f.locator('#path').getAttribute('data-segments'));await f.locator('#stack').check();assert.ok(Number(await f.locator('#path').getAttribute('data-segments'))>single);await f.locator('#color').selectOption('speed');await f.locator('#color').selectOption('feature');console.log(await p.screenshot('orca-slicer-desktop'));const pending=p.page.waitForEvent('download');await f.getByRole('link',{name:/Download G-code/}).click();const download=await pending;assert.deepEqual(await readFile(await download.path()),await readFile(p.workspace+'/part.gcode'));await p.page.setViewportSize({width:390,height:844});assert.equal(await f.locator('html').evaluate(x=>x.scrollWidth<=x.clientWidth),true);console.log(await p.screenshot('orca-slicer-mobile'));assert.deepEqual(p.errors,[]);}finally{await p.close();await browser.close();}
});