fix(practice): reset of a running open practice restarts its clock from zero (1.70.3)

This commit is contained in:
larssand committed 2026-11-06 15:12:56 +01:00
1 parent 8f748d21df
commit 5323444679
5 files changed
+15 -4

No files matched your search

+3 -1
View File
@@ -50,9 +50,11 @@ export async function runPracticeResetSmoke({ evaluate, navigate, savedState, wa
await waitFor(async () => ((await savedState()).resultsBySession?.[practice.id]?.passings || []).length === 0, "timing data cleared");
assert.deepEqual((await driverLaps()).sort(), [19000, 19500, 20000], "laps kept right after the reset");
assert.equal((await savedState()).sessions.find((session) => session.id === practice.id).status, "running", "the practice keeps running");
assert.ok((await savedState()).sessions.find((session) => session.id === practice.id).startedAt > startedAt + 500000, "the practice clock starts again from zero");
await waitFor(async () => evaluate('document.getElementById("connectionBadge")?.classList.contains("badge-online")'), "decoder connected");
decoder.sendPassing("8220001");
// The clock restarted at the reset, so the first lap is measured from there: a car crossing 20 s later.
decoder.sendPassing("8220001", Date.now() + 20000);
await waitFor(async () => ((await savedState()).resultsBySession?.[practice.id]?.passings || []).length >= 1, "a new lap after the reset");
await waitFor(async () => (await driverLaps()).length === 4, "the new lap joins the training stats");
assert.deepEqual((await driverLaps()).slice(0, 3), [20000, 19500, 19000], "the laps from before the reset are still there");