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 {chromium,preview} from './helpers.mjs';
test('Folio: real engraving, MIDI transport, tempo, seek, downloads and narrow layout',{skip:!process.env.SCORE_QA_WORKSPACE},async()=>{
 const browser=await(await chromium()).launch({headless:true});const p=await preview(browser,process.env.SCORE_QA_WORKSPACE,{file:'score.html'});
 try{const f=await p.open();await f.locator('#pages img').waitFor();assert.ok(await f.locator('#pages img').evaluate(img=>img.complete&&img.naturalWidth>0));assert.equal(await f.locator('#note-count').textContent(),'142');await f.locator('#play').click();await p.page.waitForTimeout(700);assert.equal(await f.locator('#play').getAttribute('aria-pressed'),'true');assert.ok(Number(await f.locator('#roll').getAttribute('data-position'))>.4);await f.locator('#play').click();const before=await f.locator('#roll').getAttribute('data-position');await p.page.waitForTimeout(150);assert.equal(await f.locator('#roll').getAttribute('data-position'),before);
 await f.locator('#speed').fill('0.75');assert.equal(await f.locator('#speed-value').textContent(),'0.75×');await f.locator('#seek').fill('10');await p.page.waitForTimeout(50);assert.equal(await f.locator('#position').textContent(),'0:10');await f.locator('#restart').click();assert.equal(await f.locator('#position').textContent(),'0:00');
 const download=p.page.waitForEvent('download');await f.getByText('Score PDF ↓',{exact:true}).click();assert.equal((await download).suggestedFilename(),'score.pdf');
 await f.locator('body').evaluate(()=>window.scrollTo(0,0));await p.screenshot('score-desktop');await p.page.setViewportSize({width:390,height:844});await f.locator('body').evaluate(()=>window.scrollTo(0,0));assert.equal(await f.locator('body').evaluate(()=>document.documentElement.scrollWidth<=innerWidth),true);await p.screenshot('score-mobile');assert.deepEqual(p.errors,[]);
 }finally{await p.close();await browser.close();}
});