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.
// Real rooms and browser clients. Advance only the host's simulation clock
// so two five-minute regulation rounds fit within soyLI's scenario deadline.
export default async ({ players: [host, guest], check }) => {
const button = (p, name) => p.frame.getByRole('button', { name, exact: true });
await host.frame.evaluate(() => {
const now = performance.now.bind(performance);
const interval = window.setInterval.bind(window);
let simulated;
Object.defineProperty(performance, 'now', { value: () => simulated ?? now() });
window.setInterval = (fn, delay, ...args) => {
if (delay !== 1000 / 60) return interval(fn, delay, ...args);
const start = now();
return interval(() => {
simulated = start + (now() - start) * 7;
try {
fn(...args);
} finally {
simulated = undefined;
}
}, delay);
};
});
const map = (p, name) => p.frame.locator('#hud-map').filter({ hasText: name });
const join = async (code) => {
await button(guest, 'Browse rooms').click();
await button(guest, 'Enter room code').click();
await guest.frame.getByLabel('Room code').fill(code);
await button(guest, 'Join room').click();
await guest.frame.waitForFunction(
() => +document.querySelector('#scene').dataset.ack > 0,
null,
{ timeout: 50000 },
);
};
for (const dedicated of [true, false]) {
if (dedicated) await button(host, 'Previous battlefield').click();
await button(host, 'Create room').click();
if (dedicated) {
await host.frame.getByLabel('This browser').selectOption('server');
await button(host, 'Start server').click();
await map(host, 'Alder Ridge').waitFor();
await button(host, 'Server').click();
} else await button(host, 'Open lobby').click();
const code = (await host.frame.getByText(/^Room code:/).innerText()).split(': ')[1];
if (dedicated) {
await button(host, 'Back to overview').click();
await map(host, 'Quarry Yard').waitFor({ timeout: 115000 });
check(
'empty dedicated room advances from last arena to first',
await host.frame.getByText('Dedicated host · 0 players').isVisible(),
);
await join(code);
await map(guest, 'Quarry Yard').waitFor();
check('late joiner enters the rotated map with the original room code', true);
await button(host, 'Server').click();
await button(host, 'Stop server').click();
} else {
await button(host, 'Start match').click();
await join(code);
await map(guest, 'Alder Ridge').waitFor();
await Promise.all(
[host, guest].map((p) => map(p, 'Quarry Yard').waitFor({ timeout: 115000 })),
);
await guest.frame.waitForFunction(
() =>
+document.querySelector('#scene').dataset.ack > 5 &&
document.querySelector('#scene').dataset.remote?.length,
);
check('playing host and guest rotate together and gameplay resumes', true);
await button(host, 'Open match menu').click();
await button(host, 'Leave room').click();
}
await guest.frame.getByRole('heading', { name: 'Room closed' }).waitFor({ timeout: 20000 });
// Explicit host closure may arrive via the reliable channel or provider.
await guest.frame
.getByRole('dialog')
.getByRole('button', { name: /^(Return to operations|Operations)$/ })
.click();
}
};
