feat(race): practice split into heats by cars per heat; format change rebuilds heats not run yet (1.89.46)
This commit is contained in:
1 parent
ce86f771c3
commit
74a2e9ba47
11 files changed
+159
-17
No files matched your search
@@ -83,7 +83,8 @@ export async function runRaceSetupSmoke({ evaluate, navigate, fill, savedState,
|
||||
const club = await findEvent("Browser Club Race");
|
||||
const clubSessions = (await savedState()).sessions.filter((session) => session.eventId === club.id);
|
||||
const quals = clubSessions.filter((session) => session.type === "qualification");
|
||||
assert.equal(clubSessions.filter((session) => session.type === "practice").length, 1, "one practice");
|
||||
const practices = clubSessions.filter((session) => session.type === "practice");
|
||||
assert.ok(practices.length >= 1 && practices.every((session) => session.driverIds.length <= club.raceConfig.carsPerHeat), `practice split by cars per heat: ${practices.map((session) => session.name + ":" + session.driverIds.length)}`);
|
||||
assert.ok(quals.length >= 2 && quals.every((session) => /^Q[12] H\d+$/.test(session.name) && session.generated), `qualifying heats per round: ${quals.map((session) => session.name)}`);
|
||||
assert.equal(club.raceConfig.qualifyingRounds, 2);
|
||||
console.log("PASS wizard builds qualifying as Q<round> H<heat> heats");
|
||||
@@ -97,6 +98,17 @@ export async function runRaceSetupSmoke({ evaluate, navigate, fill, savedState,
|
||||
await evaluate(`document.querySelector('.race-participant[value="${first}"]').click()`);
|
||||
await waitFor(async () => (await savedState()).sessions.some((session) => session.eventId === club.id && session.type === "qualification" && session.driverIds.includes(first)), "ticked again: back in a heat");
|
||||
console.log("PASS race participants can be changed after creation and the heats follow");
|
||||
// Format: changing cars per heat / rounds rebuilds the qualifying heats that have not run.
|
||||
const qualCount = async () => (await savedState()).sessions.filter((session) => session.eventId === club.id && session.type === "qualification").length;
|
||||
const before = await qualCount();
|
||||
await fill("raceFormatForm", { qualifyingRounds: "3", carsPerHeat: "2" });
|
||||
await submit("raceFormatForm");
|
||||
await waitFor(async () => (await savedState()).sessions.some((session) => session.eventId === club.id && session.name === "Q3 H1"), "a third round after the format change");
|
||||
const heats = (await savedState()).sessions.filter((session) => session.eventId === club.id && session.type === "qualification");
|
||||
assert.ok(heats.length > before && heats.every((session) => session.driverIds.length <= 2), `heats rebuilt with max 2 cars: ${heats.map((session) => session.name + ":" + session.driverIds.length)}`);
|
||||
const practiceHeats = (await savedState()).sessions.filter((session) => session.eventId === club.id && session.type === "practice");
|
||||
assert.ok(practiceHeats.every((session) => session.driverIds.length <= 2), `practice heats rebuilt with max 2 cars: ${practiceHeats.map((session) => session.name + ":" + session.driverIds.length)}`);
|
||||
console.log("PASS format change rebuilds the practice and qualifying heats (cars per heat, rounds)");
|
||||
}
|
||||
await navigate("race_setup", "raceWizardStepForm");
|
||||
await editEvent(race, "race_setup", "raceWizardStepForm");
|
||||
|
||||
Reference in new issue
Block a user