Back to Faultline
SOURCE / PINNED RELEASE

Made of little things.

Faultline

Release
da1ffaa5624c…
Author-recorded commit
60f5f03189db…
License
LICENSE
Author’s source reference
nostr://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf/wss%3A%2F%2Fgit.napplet.soy%2F/n-6932b12c78c

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

tests/dedicated-room.mjs
// Independent browser sessions, disposable soyLI provider. No public directory writes.
export default async ({ players: [host, guest], check, connectIdentity, network }) => {
  const button = (p, name) => p.frame.getByRole('button', { name, exact: true });
  const { pubkey } = await connectIdentity(guest);
  const profileLabel = 'Nostr ' + pubkey.slice(0, 8);
  await button(guest, 'Settings').click();
  await guest.frame.getByLabel('Play as').selectOption('nostr');
  await guest.frame.getByText(/Using your shortened public key/).waitFor();
  await button(guest, 'Done').click();
  await button(host, 'Create room').click();
  const access = host.frame.getByLabel('Room access');
  check('rooms default to free entry', (await access.inputValue()) === 'open');
  await access.selectOption('code');
  check(
    'code-only room cannot be publicly advertised',
    await host.frame.getByRole('checkbox').isDisabled(),
  );
  await host.frame.getByLabel('This browser').selectOption('server');
  await button(host, 'Start server').click();
  await host.frame.getByText('Dedicated host · 0 players').waitFor();
  await host.frame.waitForFunction(() =>
    /^4:/.test(document.querySelector('#round-clock').textContent),
  );
  check(
    'empty server shows the running arena with no avatar or seat',
    (await host.frame.locator('#scene').isVisible()) &&
      (await host.frame.locator('.server-marker').count()) === 0 &&
      (await host.frame.locator('#scene').getAttribute('data-seat')) === '-1',
  );
  await button(host, 'Server').click();
  const code = (await host.frame.getByText(/^Room code:/).textContent()).split(': ')[1];
  await button(host, 'Back to overview').click();
  async function join() {
    await button(guest, 'Browse rooms').click();
    await guest.frame.getByText(/No open rooms/).waitFor();
    await button(guest, 'Enter room code').click();
    await guest.frame.getByRole('textbox', { name: 'Room code' }).fill(code);
    await button(guest, 'Join room').click();
    await guest.frame.waitForFunction(
      () => +document.querySelector('#scene').dataset.ack > 0,
      null,
      { timeout: 50000 },
    );
  }
  await join();
  await host.frame.locator('.server-marker', { hasText: profileLabel }).waitFor();
  await network({ latencyMs: 30, jitterMs: 20, lossRatio: 0.04, retransmitMs: 150, seed: 5 });
  const markerPosition = () => host.frame.locator('.server-marker').evaluate(el => el.style.cssText);
  const initial = await markerPosition();
  const key = (type, code) => guest.frame.evaluate(({ type, code }) =>
    document.querySelector('#scene').dispatchEvent(new KeyboardEvent(type, { code, bubbles: true })), { type, code });
  await key('keydown', 'KeyD');
  try {
    await host.frame.waitForFunction(initial => document.querySelector('.server-marker')?.style.cssText !== initial, initial);
  } finally { await key('keyup', 'KeyD'); }
  check('3D host tracks the moving player with their selected Nostr identity', true);
  await key('keydown', 'KeyG');
  await new Promise(r => setTimeout(r, 180));
  await key('keyup', 'KeyG');
  await host.frame.waitForFunction(() => Number(document.querySelector('#scene').dataset.blasts) > 0);
  check('dedicated observer renders the authoritative explosion', true);

  await button(host, 'Server').click();
  await host.frame
    .locator('.roster-row')
    .getByText(/^\d+ ms$/)
    .waitFor({ timeout: 25000 });
  await button(guest, 'Players').click();
  await guest.frame
    .locator('#scoreboard:not([hidden]) tbody tr')
    .getByText(/^\d+ ms$/)
    .waitFor();
  check(
    'dedicated server runs a single remote player and reports real RTT',
    (await host.frame.locator('.roster-row').count()) === 1 &&
      (await guest.frame.locator('#score-rows tr').count()) === 1 &&
      (await guest.frame.locator('#scene').getAttribute('data-remote')) === '',
  );
  await button(guest, 'Open match menu').click();
  await button(guest, 'Leave room').click();
  await button(host, 'Back to overview').click();
  await host.frame.getByText('Dedicated host · 0 players').waitFor({ timeout: 15000 });
  await join();
  check('server accepts joins again after returning to zero players', true);
  await button(host, 'Server').click();
  await button(host, 'Stop server').click();
  await guest.frame.getByRole('heading', { name: 'Room closed' }).waitFor({ timeout: 20000 });
  check('stopping the server ends the guest session', true);
};