Wait for authoritative stop before gathering or looting
This commit is contained in:
+12
-1
@@ -34,6 +34,17 @@ test('desktop renders models, moves authoritatively, gathers, and reconnects', a
|
||||
const errors: string[] = [];
|
||||
page.on('pageerror', error => errors.push(error.message));
|
||||
await page.setViewportSize({ width: 1440, height: 900 });
|
||||
// Regression: sparse input plus stale snapshots used to overshoot the tree,
|
||||
// send gathering intents from outside server range, then abandon the action.
|
||||
// Keep the real simulation and input handlers; delay only delivery/cadence.
|
||||
await page.routeWebSocket('**/ws', socket => {
|
||||
const server = socket.connectToServer();
|
||||
server.onMessage(message => { setTimeout(() => socket.send(message), 1500); });
|
||||
});
|
||||
await page.addInitScript(() => {
|
||||
const interval = window.setInterval.bind(window);
|
||||
window.setInterval = ((handler, delay, ...args) => interval(handler, delay === 50 ? 1500 : delay, ...args)) as typeof window.setInterval;
|
||||
});
|
||||
await enter(page);
|
||||
// Gather from the spawn clearing before testing keyboard movement. A delayed
|
||||
// key release can otherwise change the nearest resource (including its risk
|
||||
@@ -61,7 +72,7 @@ test('desktop renders models, moves authoritatively, gathers, and reconnects', a
|
||||
};
|
||||
});
|
||||
return (gatherDiagnostics as { gainedXP: boolean }).gainedXP;
|
||||
}, { timeout: 15000, message: 'Gather must award profession XP' }).toBe(true);
|
||||
}, { timeout: 30000, message: 'Gather must award profession XP despite delayed stop acknowledgement' }).toBe(true);
|
||||
} catch (error) {
|
||||
// toMatchObject omits unmatched properties from its diff. Put the complete
|
||||
// last sample in the error so CI's text log actually includes diagnostics.
|
||||
|
||||
Reference in New Issue
Block a user