SOURCE / PINNED RELEASE
Made of little things.
Limb Race
- Release
- 6a8ae4fc626e…
- Author-recorded commit
- 008c01ee6454…
- License
- LICENSE
- Author’s source reference
- nostr://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf/wss%3A%2F%2Fgit.napplet.soy%2F/n-c2869f12ad8
Archive hash verified: 7be8492d1f89b891…. The source-to-build association is the author’s claim; it has not been independently rebuilt.
import { createRequire } from 'node:module';
import {realpathSync} from 'node:fs';
import assert from 'node:assert/strict';
const require=createRequire(realpathSync(new URL('../node_modules/@napplet/conformance-cli/package.json',import.meta.url)));
const {chromium}=require('playwright');
assert.ok(process.argv[2], 'Pass the URL printed by soyli dev');
const browser=await chromium.launch({headless:true});
try {
const errors=[];
const context=await browser.newContext({viewport:{width:900,height:600}});
const page=await context.newPage();page.on('pageerror',e=>errors.push(e.message));
await page.goto(process.argv[2]);await page.waitForTimeout(1800);
let f=page.frames().find(f=>f.url()==='about:srcdoc');assert.ok(f);
async function size(w,h){await page.setViewportSize({width:w,height:h});await page.locator('iframe').evaluate((el,{w,h})=>{el.style.cssText=`position:fixed;inset:0;width:${w}px;height:${h}px;min-height:0;border:0;z-index:9999`;},{w,h});await page.waitForTimeout(100);const dims=await f.evaluate(()=>[innerWidth,innerHeight]);assert.deepEqual(dims,[w,h]);}
await size(900,600);
console.log('theme',await f.evaluate(async()=>await window.napplet.theme.get()));
await f.locator('[data-preset="runner"]').click();await f.locator('#race').click();
assert.equal(await f.locator('#clear').isDisabled(),true);
await page.waitForTimeout(1300);await f.locator('#pause').click();const paused=await f.locator('#time').innerText();await page.waitForTimeout(250);assert.equal(await f.locator('#time').innerText(),paused);
await f.locator('#message-action').click();
await f.locator('#message-title').filter({hasText:'Look at you go.'}).waitFor({timeout:60000});
console.log('FINISH',await f.locator('#message-detail').innerText());assert.equal(await f.locator('.score-row').count(),1);
await f.locator('#share-result').click();await f.locator('#share-result').filter({hasText:'Time shared'}).waitFor({timeout:30000});console.log('SHARED OK');
await f.locator('#message-action').click();await f.locator('#shared').click();await f.locator('.score-row').first().waitFor({timeout:15000});console.log('BOARD',await f.locator('#score-list').innerText());
await f.locator('#personal').click();await f.locator('.score-row').first().click();assert.equal(await f.locator('#design-dialog').isVisible(),true);await f.locator('#use-design').click();
await f.locator('#live').click();await f.locator('#race').click();await page.waitForTimeout(500);await f.locator('[data-preset="star"]').click();assert.equal(await f.locator('#clear').isDisabled(),false);await f.locator('#pause').click();
await f.locator('#message-action').click();await page.waitForTimeout(200);await f.locator('#restart').click();
// Draw using real pointer input, then inspect normalized stroke count.
await f.locator('#clear').click();const box=await f.locator('#draw-canvas').boundingBox();await page.mouse.move(box.x+box.width/2,box.y+box.height/2);await page.mouse.down();await page.mouse.move(box.x+box.width/2+40,box.y+box.height/2+35,{steps:12});await page.mouse.up();assert.match(await f.locator('#ink-count').innerText(),/^1/);await f.locator('#undo').click();assert.match(await f.locator('#ink-count').innerText(),/^0/);
await f.locator('[data-preset="runner"]').click();
for(const scheme of ['light','dark']){
await page.evaluate(scheme=>{document.querySelector('iframe').contentWindow.postMessage({type:'theme.changed',theme:{colors:scheme==='dark'?{background:'#172521',text:'#e5ecdf',primary:'#a8cf8b'}:{background:'#f8f6ed',text:'#292d23',primary:'#72ac98'}}},'*');},scheme);await page.waitForTimeout(150);
for(const [w,h] of [[200,160],[320,560],[900,600],[2400,1200]]){
await size(w,h);const state=await f.evaluate(()=>({w:innerWidth,h:innerHeight,overflow:document.documentElement.scrollWidth>innerWidth,notice:getComputedStyle(document.querySelector('.too-small')).display,bg:getComputedStyle(document.body).backgroundColor,dark:document.documentElement.classList.contains('dark')}));
assert.equal(state.dark,scheme==='dark');assert.equal(state.overflow,false);assert.equal(state.notice,w<240?'grid':'none');console.log('LAYOUT',scheme,state);
if(w===900||w===320)await f.locator('body').screenshot({path:`.napplet-space/promotion/${scheme}-${w}.png`});
}
}
await size(900,600);await page.reload();await page.waitForTimeout(1500);f=page.frames().find(f=>f.url()==='about:srcdoc');assert.ok(f);await f.locator('#classic').click();assert.ok(await f.locator('.score-row').count()>0, 'local history survives reload');console.log('PERSISTENCE OK');
console.log('ERRORS',errors);assert.deepEqual(errors,[]);
} finally { await browser.close(); }
