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/public-room.mjs
// Run using the feature soyLI. Every request goes through the local preview CVM.
export default async ({ players: [host, guest], check }) => {
  const btn = (p, name) => p.frame.getByRole('button', { name, exact: true });
  await btn(host, 'Create room').click();
  await host.frame.getByLabel('Show this lobby in Playing now across shells').check();
  await btn(host, 'Open lobby').click();
  await host.frame.getByText(/Room code:/).waitFor();
  // Read as a scoped guest and keep the joining browser cold, as on the landing page. The
  // runtime. Public provider descriptor is aliased by soyLI to the disposable provider.
  const ref = {
    pubkey: '60517f64548279854ee9a122531e4d1a413e3dc956e2d0a450217420623ca688',
    relays: ['wss://relay.napplet.soy/'],
  };
  const read = (p) =>
    p.frame.evaluate(async (ref) => {
      const { message } = await Promise.resolve(
        window.napplet.cvm.request(ref, {
          jsonrpc: '2.0',
          id: 1,
          method: 'tools/call',
          params: { name: 'soy_room_directory', arguments: {} },
        }),
      ).then((r) => (r.message ? r : { message: r }));
      return message.result.structuredContent.rooms;
    }, ref);
  const rows = await read(host);
  check(
    'only public title and counts are visible',
    rows.length === 1 && !rows[0].title.includes('|') && !rows[0].peers && rows[0].players === 1,
  );
  await btn(host, 'Start match').click();
  await host.frame.locator('#scene[data-position]').waitFor();
  const playing = (await read(host))[0];
  check(
    'solo-hosted match remains open to late joins',
    playing.phase === 'playing' && playing.accepting,
  );
  const entry = playing.entry;
  const target = new URL(guest.page.url());
  for (const name of ['provider', 'protocol', 'room']) target.searchParams.set(name, entry[name]);
  await guest.page.goto(target.href);
  const offered = guest.page.frameLocator('#stage iframe');
  await offered.getByRole('heading', { name: 'Join a public room?' }).waitFor();
  check('opening the room link prompts without joining', (await read(host))[0].players === 1);
  await offered.getByRole('button', { name: 'Join room', exact: true }).click();
  await offered.locator('#scene[data-remote]:not([data-remote=""])').waitFor({ timeout: 60000 });
  check('entry admitted to the original room', (await read(host))[0].players === 2);
  await btn(host, 'Open match menu').click();
  await btn(host, 'Leave room').click();
  check('host departure withdraws the listing', (await read(host)).length === 0);
};