Loading files
442335385This file is pinned to the selected release. Download the original to open it in your design tool.
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();}
});