Back to Napplet Machines V8
SOURCE / PINNED RELEASE

Made of little things.

Napplet Machines V8

Release
b3f614e739f0…
Author-recorded commit
534f19acb4ba…
License
LICENSE
Author’s source reference
nostr://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf/wss%3A%2F%2Fgit.napplet.soy%2F/n-b5572362d4a

Archive hash verified: 0f7feb97e2c3d336…. The source-to-build association is the author’s claim; it has not been independently rebuilt.

tests/circuits.mjs
import { mkdir } from 'node:fs/promises';
export default async ({ players, check, measure }) => {
  const { page, frame } = players[0],
    element = await frame.frameElement();
  await mkdir('.napplet-space/promotion', { recursive: true });
  await page.setViewportSize({ width: 1200, height: 750 });
  await element.evaluate((el) =>
    Object.assign(el.style, {
      position: 'fixed',
      top: 0,
      left: 0,
      width: '1200px',
      height: '750px',
      minHeight: 0,
      border: 0,
      zIndex: 9999,
    }),
  );
  await frame.waitForFunction(() => innerWidth === 1200 && innerHeight === 750);
  check(
    'seven circuits available',
    (await frame.locator('#trackSelect option').count()) === 7,
  );
  for (let i = 0; i < 7; i++) {
    await frame.locator('#trackSelect').selectOption(String(i));
    await page.waitForTimeout(1700);
    const facts = await frame
      .locator('#scene')
      .evaluate((el) => ({ ...el.dataset }));
    check(
      `circuit ${i + 1}: bounded mesh, island and finite camera`,
      facts.renderReady === 'true' &&
        Number(facts.roadSamples) < 1300 &&
        Number(facts.buildings) >= 5 &&
        (i < 3 || Number(facts.islandWidth) > 240),
    );
    await element.screenshot({
      path: `.napplet-space/promotion/circuit-${i}.png`,
    });
  }
  await frame.locator('#trackSelect').selectOption('2');
  await frame.getByRole('button', { name: 'Workshop', exact: false }).click();
  check(
    'closed corners are explained in workshop',
    await frame.locator('#curveNotice').isVisible(),
  );
  await frame.locator('#fullPlan').click();
  check(
    'full plan exposes the doubled build area',
    Number(await frame.locator('#plan').getAttribute('data-span')) === 290,
  );
  const box = await frame.locator('#plan').boundingBox();
  const scale = Number(await frame.locator('#plan').getAttribute('data-scale'));
  await frame.locator('#addPoint').click();
  await page.mouse.click(
    box.x + box.width / 2 + 122 * scale,
    box.y + box.height / 2 - 105 * scale,
  );
  check(
    'point placement works beyond the old 65 m boundary',
    (await frame.locator('#pointCount').innerText()) === '10 / 32',
  );
  await frame.locator('#trackName').fill('Wide World');
  await frame.locator('#saveTrack').click();
  await frame.waitForFunction(
    () => document.querySelector('#saveState').textContent === 'SAVED',
  );
  await frame.locator('#loadTrack').click();
  check(
    'expanded draft survives SDK save/load',
    (await frame.locator('#pointCount').innerText()) === '10 / 32' &&
      (await frame.locator('#trackName').inputValue()) === 'Wide World',
  );
  await frame.locator('#fitPlan').click();
  await element.screenshot({
    path: '.napplet-space/promotion/expanded-workshop.png',
  });
  await frame.getByRole('button', { name: 'Garage', exact: false }).click();
  await frame.locator('#trackSelect').selectOption('4');
  await frame.locator('#gridSize').selectOption('6');
  await frame.locator('#raceButton').click();
  await frame.waitForFunction(
    () => document.querySelector('#scene').dataset.countdown === '0',
  );
  const values = await frame.evaluate(async () => {
    const times = [];
    let last = performance.now();
    for (let i = 0; i < 150; i++) {
      await new Promise(requestAnimationFrame);
      const now = performance.now();
      times.push(now - last);
      last = now;
    }
    return times.slice(10).sort((a, b) => a - b);
  });
  measure(
    'large-course-six-car-frame-p95',
    values[Math.floor(values.length * 0.95)],
    50,
  );
  check(
    'large-course six-car frame p95 under 50 ms',
    values[Math.floor(values.length * 0.95)] < 50,
  );
  const before = Number(
    await frame.locator('#scene').getAttribute('data-local-x'),
  );
  await frame.locator('#scene').focus();
  await page.keyboard.down('ArrowUp');
  await page.waitForTimeout(1500);
  await page.keyboard.up('ArrowUp');
  const after = Number(
    await frame.locator('#scene').getAttribute('data-local-x'),
  );
  check(
    'driving stays live outside the old world boundary',
    Math.abs(before) > 90 && Math.abs(after - before) > 2,
  );
  await element.screenshot({
    path: '.napplet-space/promotion/summit-race.png',
  });
  await frame.locator('#exitRace').click();
  await frame.locator('#trackSelect').selectOption('0');
};