fix(control): followers update live, phones use the page address, master is visible (1.77.2)
This commit is contained in:
1 parent
0589fe5f65
commit
a4e734dd74
13 files changed
+119
-22
No files matched your search
@@ -21,12 +21,13 @@ export async function runRaceControllerSmoke({ evaluate, navigate, savedState, w
|
||||
const firstId = await evaluate('sessionStorage.getItem("rc_controller_client_id")');
|
||||
await waitFor(async () => (await controller())?.clientId === firstId, "the first admin browser is the master");
|
||||
await waitFor(async () => await evaluate('document.getElementById("connectionBadge")?.classList.contains("badge-online")'), "master connects to the decoder");
|
||||
assert.equal(await evaluate('document.getElementById("controllerBanner").hidden'), true, "no banner on the master");
|
||||
await waitFor(async () => await evaluate('!document.getElementById("controllerBanner").hidden && document.getElementById("controllerBanner").classList.contains("is-master")'), "the master sees that it is the master");
|
||||
assert.ok(await evaluate('Boolean(document.getElementById("controllerRelease"))'), "with a Release button");
|
||||
const connectsBefore = decoder.totalConnections();
|
||||
|
||||
target = await (await fetch(`http://127.0.0.1:${debugPort}/json/new?${encodeURIComponent(base + "/?view=settings")}`, { method: "PUT" })).json();
|
||||
second = await attach(target);
|
||||
await second.waitFor(async () => (await second.evaluate('document.getElementById("controllerBanner")?.hidden')) === false, "second browser shows the follow banner");
|
||||
await second.waitFor(async () => Boolean(await second.evaluate('document.getElementById("controllerTakeOver")')), "second browser shows the follow banner");
|
||||
await pause(1500);
|
||||
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/);
|
||||
@@ -36,11 +37,15 @@ export async function runRaceControllerSmoke({ evaluate, navigate, savedState, w
|
||||
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.waitFor(async () => Boolean(await second.evaluate('document.querySelector(\'#speakerPanel [data-race-audio-cue="race_resumed"]\')')) && Boolean(await second.evaluate('document.getElementById("controllerTakeOver")')), "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");
|
||||
// The follower is updated live from the server, without a reload.
|
||||
const renamed = await savedState();
|
||||
await patchState({ sessions: renamed.sessions.map((session) => (session.id === heat.id ? { ...session, name: "RC Ctrl Heat Live" } : session)) });
|
||||
await second.waitFor(async () => (await second.evaluate("document.querySelector('.content').innerText")).includes("RC Ctrl Heat Live"), "the follower shows the change within seconds", 5000);
|
||||
const cleaned = await savedState();
|
||||
await patchState({ sessions: cleaned.sessions.filter((session) => session.id !== heat.id), activeSessionId: before.activeSessionId || null });
|
||||
|
||||
@@ -48,9 +53,9 @@ export async function runRaceControllerSmoke({ evaluate, navigate, savedState, w
|
||||
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);
|
||||
await waitFor(async () => Boolean(await evaluate('document.getElementById("controllerTakeOver")')), "the old master sees the follow 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 or pause/resume, takes over, and the first one lets go");
|
||||
console.log("PASS Race Controller Master: a second browser follows live 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