Back to Body Journal
SOURCE / PINNED RELEASE

Made of little things.

Body Journal

Release
e8049f8da4e2…
Author-recorded commit
61c04bf0e8aa…
License
LICENSE
Author’s source reference
nostr://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf/wss%3A%2F%2Fgit.napplet.soy%2F/n-6c4554844c7

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

tests/synthetic-case-ui.mjs
import {openAnatomy,closeAnatomy} from './anatomy-ui-helpers.mjs';

/** Seed synthetic smoke-test data through the same marking/forms used by patients. */
export async function seedSyntheticCase(frame) {
  await frame.locator('#app[data-ready="true"]').waitFor();
  const hasScene = !(await frame.locator('#webglFallback').isVisible());
  if (hasScene) {
    await closeAnatomy(frame);
    await frame.locator('#anatomyLayer').selectOption('skin');
    await frame.locator('[data-pose="standing"]').click();
    await openAnatomy(frame);await frame.locator('#anatomySearch').fill('left lower leg');
    await frame.locator('[data-focus="region:left-calf-surface"]').click();await frame.locator('#applyFocus').click();await closeAnatomy(frame);
    await frame.locator('button[data-mode="paint"]').click();
    await frame.evaluate(()=>new Promise(r=>requestAnimationFrame(()=>requestAnimationFrame(r))));
    const box=await frame.locator('canvas').boundingBox(),mouse=frame.page().mouse;let marked=false;
    outer:for(const y of [.16,.2,.24,.28,.32,.36,.4,.44,.12,.08,.5])for(const x of [.5,.46,.54,.42,.58]){
      await mouse.move(box.x+box.width*x,box.y+box.height*y);
      if((await frame.locator('#sceneHint').innerText()).startsWith('Left knee')){await mouse.click(box.x+box.width*x,box.y+box.height*y);marked=true;break outer;}
    }
    if(!marked)throw new Error('Synthetic setup could not mark the left knee');
  } else {
    await frame.locator('#chooseRegion').click();await frame.locator('[data-region="Left knee"]').click();
  }
  await frame.locator('#location').fill('Left knee · front');await frame.locator('#location').press('Tab');
  await frame.locator('#severity').fill('4');await frame.locator('#severity').dispatchEvent('input');
  await frame.locator('#onset').selectOption('1–2 weeks ago');
  await frame.locator('#description').fill('A dull ache around the front of my knee. More noticeable after a run or going downstairs.');
  for(const trigger of ['After exercise','Moving'])await frame.locator(`[data-trigger="${trigger}"]`).click();
  if (hasScene) { await openAnatomy(frame);await frame.locator('#wholeBody').click();await closeAnatomy(frame); }
  await frame.locator('#generalConcern').click();await frame.locator('[data-region="Fatigue"]').click();
  await frame.locator('#description').fill('I have been feeling more tired than usual this week.');await frame.locator('#onset').selectOption('A few days ago');
  await frame.locator('#age').fill('34');await frame.locator('#concern-toggle-1').click();await frame.locator('button[data-mode="rotate"]').click();
}