fix(control): pause, resume, false start and reset are master-only too (1.77.1)
This commit is contained in:
1 parent
cf3a4c5fdb
commit
0589fe5f65
8 files changed
+35
-9
No files matched your search
@@ -31,13 +31,26 @@ export async function runRaceControllerSmoke({ evaluate, navigate, savedState, w
|
||||
assert.equal(decoder.totalConnections(), connectsBefore, "the second browser does not connect to the decoder");
|
||||
assert.match(await second.evaluate('document.getElementById("controllerBanner").textContent'), /Race Controller Master/);
|
||||
|
||||
// The follower cannot pause, resume or reset the heat (speaker panel or Race Day).
|
||||
const before = await savedState();
|
||||
const heat = { id: "rc_ctrl_heat", eventId: before.events[0]?.id || "", name: "RC Ctrl Heat", type: "final", mode: "race", status: "paused", startMode: "position", durationMin: 5, startedAt: Date.now() - 60000, pausedAt: Date.now() - 30000, totalPausedMs: 0, driverIds: [] };
|
||||
await patchState({ sessions: [...before.sessions, heat], activeSessionId: heat.id });
|
||||
await second.evaluate(`location.href = ${JSON.stringify(base + "/?view=race_day")}; true`);
|
||||
await second.waitFor(async () => Boolean(await second.evaluate('document.querySelector(\'#speakerPanel [data-race-audio-cue="race_resumed"]\')')) && (await second.evaluate('document.getElementById("controllerBanner").hidden')) === false, "follower on Race Day");
|
||||
await second.evaluate('document.querySelector(\'#speakerPanel [data-race-audio-cue="race_resumed"]\').click(); true');
|
||||
await pause(1500);
|
||||
assert.equal((await savedState()).sessions.find((session) => session.id === heat.id).status, "paused", "the follower's Resume does nothing");
|
||||
assert.equal(await second.evaluate('document.getElementById("controllerBanner").classList.contains("is-flash")'), true, "the banner points at Take over");
|
||||
const cleaned = await savedState();
|
||||
await patchState({ sessions: cleaned.sessions.filter((session) => session.id !== heat.id), activeSessionId: before.activeSessionId || null });
|
||||
|
||||
await second.evaluate('window.confirm = () => true; document.getElementById("controllerTakeOver").click(); true');
|
||||
const secondId = await second.evaluate('sessionStorage.getItem("rc_controller_client_id")');
|
||||
await waitFor(async () => (await controller())?.clientId === secondId, "take over moves the master");
|
||||
await waitFor(async () => decoder.totalConnections() > connectsBefore, "the new master connects to the decoder");
|
||||
await waitFor(async () => (await evaluate('document.getElementById("controllerBanner").hidden')) === false, "the old master sees the banner", 12000);
|
||||
assert.equal(await evaluate("document.getElementById('connectionBadge').classList.contains('badge-online')"), false, "the old master lets go of the decoder");
|
||||
console.log("PASS Race Controller Master: a second browser follows without the decoder, takes over, and the first one lets go");
|
||||
console.log("PASS Race Controller Master: a second browser follows without the decoder or pause/resume, takes over, and the first one lets go");
|
||||
|
||||
// Back to the first browser for the rest of the suite.
|
||||
await evaluate('window.confirm = () => true; document.getElementById("controllerTakeOver").click(); true');
|
||||
|
||||
Reference in new issue
Block a user