feat(sponsor): quick setup with guest drivers, shared rental cars, rotating heats and A/B finals (1.63.0)

This commit is contained in:
larssand committed 2026-11-05 18:31:57 +01:00
1 parent 6142b14e47
commit d0a5df6992
19 files changed
+511 -54

No files matched your search

+29
View File
@@ -27,6 +27,35 @@ export async function runRaceSetupSmoke({ evaluate, navigate, fill, savedState,
await waitFor(async () => (await savedState()).sessions.some(session => session.name === "Sponsor Heat" && session.eventId === sponsor.id), "sponsor session");
console.log("PASS sponsor-event create/edit/reload and session creation");
// Quick setup: two rental cars, three guests -> 2 groups, practice + 2 qualifying rounds,
// drivers swap cars; guests stay out of the club driver list.
for (const [name, tp] of [["Hyrbil 1", "990001"], ["Hyrbil 2", "990002"]]) {
await waitFor(async () => Boolean(await evaluate('Boolean(document.getElementById("sponsorAddCar"))')), "sponsor setup panel");
await fill("sponsorSetupForm", { newCarName: name, newCarTp: tp });
await click("sponsorAddCar");
await waitFor(async () => (await savedState()).cars.some((car) => car.transponder === tp), "rental car " + name);
}
await waitFor(async () => Boolean(await evaluate('document.querySelectorAll("#sponsorSetupForm input[name=car]:checked").length === 2')), "both cars ticked");
await evaluate('document.querySelector("#sponsorSetupForm textarea[name=guests]").value = \"Gäst Anna\\nGäst Bosse\\nGäst Cissi\"');
await submit("sponsorSetupForm");
await waitFor(async () => (await savedState()).sessions.filter((session) => session.eventId === sponsor.id && session.carAssignments).length === 6, "sponsor heats");
{
const saved = await savedState();
const guests = saved.drivers.filter((driver) => driver.guestEventId === sponsor.id);
assert.equal(guests.length, 3);
const heats = saved.sessions.filter((session) => session.eventId === sponsor.id && session.carAssignments);
assert.deepEqual(heats.map((session) => session.name).slice(2), ["Q1 H1", "Q1 H2", "Q2 H1", "Q2 H2"]);
assert.ok(heats[0].name.endsWith(" G1") && heats[1].name.endsWith(" G2") && heats[0].type === "practice", "one practice per group");
const q1 = heats.find((session) => session.name === "Q1 H1");
const q2 = heats.find((session) => session.name === "Q2 H1");
assert.notEqual(q1.carAssignments[q1.driverIds[0]], q2.carAssignments[q2.driverIds[0]], "drivers swap cars between rounds");
await navigate("drivers", "driverForm");
assert.equal(await evaluate('document.getElementById("view").textContent.includes("Gäst Anna")'), false, "guests not in the driver list");
await navigate("events", "eventForm");
await click("event-manage-" + sponsor.id);
}
console.log("PASS sponsor quick setup: guests, rental cars, rotating heats");
await navigate("race_setup", "raceWizardStepForm");
await fill("raceWizardStepForm", { name: "Browser Endurance", date: "2026-09-08", classId: "test_class", presetId: "endurance" });
await click("raceWizardNext");