fix(race-day): reset a heat to ready with its clock at zero, keep recent races listed (1.45.2)
This commit is contained in:
1 parent
7376595001
commit
ab1c26a89b
7 files changed
+62
-14
No files matched your search
@@ -47,6 +47,24 @@ export async function runRaceDayQuickSmoke({ evaluate, navigate, savedState, wai
|
||||
await waitFor(async () => Boolean(await evaluate(`document.getElementById("raceDayResetSession")`)), "Reset data is on Race Day for a heat that is not running");
|
||||
console.log("PASS Race Day's session picker switches the selected session");
|
||||
|
||||
// A finished heat can be picked again and reset to run again: clock back to zero, no laps.
|
||||
const ranAt = Date.now() - 600000;
|
||||
await patchState({
|
||||
sessions: [...(await savedState()).sessions, { id: "rq_done", eventId: "rq_event", name: "RQ Heat 2", type: "qualification", status: "finished", durationMin: 5, startedAt: ranAt, endedAt: ranAt + 300000, finishedByTimer: true }],
|
||||
resultsBySession: { ...(await savedState()).resultsBySession, rq_done: { passings: [{ id: "p1", timestamp: ranAt + 20000, lapMs: 20000 }], competitors: {}, adjustments: [] } },
|
||||
});
|
||||
await navigate("race_day", "raceDaySessionSelect");
|
||||
assert.ok(await evaluate(`[...document.getElementById("raceDaySessionSelect").options].some((option) => option.value === "rq_done")`), "the finished heat is in the list");
|
||||
await evaluate(`(() => { const select = document.getElementById("raceDaySessionSelect"); select.value = "rq_done"; select.dispatchEvent(new Event("change")); })()`);
|
||||
await waitFor(async () => Boolean(await evaluate(`document.getElementById("raceDayResetSession")`)), "Reset data for the finished heat");
|
||||
await evaluate(`document.getElementById("raceDayResetSession").click()`);
|
||||
await waitFor(async () => (await savedState()).sessions.find((session) => session.id === "rq_done")?.status === "ready", "the heat is ready to run again");
|
||||
const reset = (await savedState()).sessions.find((session) => session.id === "rq_done");
|
||||
assert.deepEqual([reset.startedAt || null, reset.endedAt || null, reset.finishedByTimer], [null, null, false], "the clock is back at zero");
|
||||
assert.equal((await savedState()).resultsBySession.rq_done?.passings?.length || 0, 0, "its laps are cleared");
|
||||
await waitFor(async () => Boolean(await evaluate(`document.getElementById("raceDayStart")`)), "Start is offered again");
|
||||
console.log("PASS a finished heat can be picked and reset: clock to zero, laps cleared, Start again");
|
||||
|
||||
await navigate("timing", "activeSessionSelect");
|
||||
assert.equal(await evaluate(`Boolean(document.getElementById("startSession") || document.getElementById("resetSession") || document.getElementById("stopSession"))`), false, "no run controls on Timing");
|
||||
await evaluate(`document.getElementById("timingOpenRaceDay").click()`);
|
||||
|
||||
Reference in new issue
Block a user