Give scheduled "Practice" sessions the real start ceremony too

A "practice" session used as a scheduled slot in a structured
race/sponsor event's session plan silently skipped the entire
countdown/lights/start-tone ceremony and jumped straight to running,
unlike qualifying/heat/final. Narrowed the ceremony-skip check to
only the standalone "Quick Open Practice" shortcut and free_practice
(both rolling/best-lap ranked with no fixed roster) - "practice" is
already ranked like a real timed session in every other respect and
now gets the same start sequence.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
larssand
2026-09-10 23:00:31 +02:00
parent cf89086dff
commit 85e18db0ed
6 changed files with 54 additions and 10 deletions

View File

@@ -2,11 +2,13 @@ import assert from "node:assert/strict";
import { startFakeDecoder } from "./browser_fake_decoder.js";
import { RACE_AUDIO_EVENT_DEFINITIONS } from "../src/race_audio.js";
// Practice types skip the countdown/light/audio sequence entirely (see
// startSessionWithAudio in src/app.js) - already covered by browser_race_day.js.
// heat/qualification/final/team_race all run the real sequence in src/race_audio.js's
// runStartSequence, gating the session's transition to "running" until it completes -
// this file exercises that for each of those four types, plus pause/resume/finish.
// Only the casual, come-and-go practice modes (open_practice - the standalone "Quick Open
// Practice" shortcut - and free_practice) skip the countdown/light/audio sequence entirely
// (see startSessionWithAudio in src/app.js). "practice" is a proper scheduled slot in a
// structured event's session plan and, like heat/qualification/final/team_race, runs the
// real sequence in src/race_audio.js's runStartSequence, gating the session's transition
// to "running" until it completes - this file exercises that for each of those five types,
// plus pause/resume/finish, and separately confirms open_practice still skips it.
//
// Every effect/voice is silenced via raceAudio.events so the sequence's own audio
// playback (real <audio> elements, speechSynthesis) never has to actually complete in a
@@ -51,6 +53,8 @@ export async function runRaceDayStartSequencesSmoke({ evaluate, navigate, waitFo
{ id: "rdts_quali", eventId: event.id, name: "RDTS Qualification", type: "qualification", durationMin: 5, status: "ready" },
{ id: "rdts_final", eventId: event.id, name: "RDTS Final", type: "final", durationMin: 5, status: "ready" },
{ id: "rdts_team_race", eventId: event.id, name: "RDTS Team Race", type: "team_race", durationMin: 5, status: "ready" },
{ id: "rdts_practice", eventId: event.id, name: "RDTS Practice", type: "practice", durationMin: 5, status: "ready" },
{ id: "rdts_open_practice", eventId: event.id, name: "RDTS Open Practice", type: "open_practice", durationMin: 5, status: "ready" },
];
try {
@@ -112,6 +116,7 @@ export async function runRaceDayStartSequencesSmoke({ evaluate, navigate, waitFo
[sessions[1], ["start_sequence", "qualifying_start", "drivers_ready"], "qualification"],
[sessions[2], ["start_sequence", "drivers_ready"], "final"],
[sessions[3], ["start_sequence", "drivers_ready"], "team_race"],
[sessions[4], ["start_sequence", "drivers_ready"], "practice"],
]) {
await patchState({ activeSessionId: session.id });
await navigate("race_day", "raceDayStart");
@@ -129,6 +134,20 @@ export async function runRaceDayStartSequencesSmoke({ evaluate, navigate, waitFo
console.log(`PASS ${label} runs the real start sequence (not the practice shortcut) and supports pause/resume/finish`);
}
// --- open_practice: the standalone "Quick Open Practice" shortcut still skips the
// ceremony entirely and jumps straight to running, unlike the scheduled "practice"
// type just proven above. ---
const beforeOpenPracticeLog = (await savedState()).audioEventLog.length;
await patchState({ activeSessionId: sessions[5].id });
await navigate("race_day", "raceDayStart");
await waitFor(async () => (await buttonDisabled("raceDayStart")) === false, "open_practice preflight ready");
await click("raceDayStart");
await waitFor(async () => (await findSession(sessions[5].id)).status === "running", "open_practice jumps straight to running", 5000);
const afterOpenPracticeLog = (await savedState()).audioEventLog;
const newOpenPracticeEntries = afterOpenPracticeLog.slice(0, afterOpenPracticeLog.length - beforeOpenPracticeLog);
assert.deepEqual(newOpenPracticeEntries.map((entry) => entry.event), [], "open_practice still skips the whole ceremony - no new audio events logged: " + JSON.stringify(newOpenPracticeEntries.map((e) => e.event)));
console.log("PASS open_practice (Quick Open Practice shortcut) still skips the countdown/lights/audio ceremony entirely");
assert.deepEqual(dialogs, [], "no unexpected native dialog during the start-sequence flow");
} finally {
const cleanup = await savedState();