feat(day): one start time - Race setup's start time and gap are Race Day's, with Race Day's times shown (1.89.17)

This commit is contained in:
larssand committed 2026-11-13 09:40:48 +01:00
1 parent cb29c5471b
commit f8080ffaeb
11 files changed
+122 -17

No files matched your search

+26 -2
View File
@@ -36,9 +36,9 @@ export async function runEventScheduleSmoke({ evaluate, navigate, fill, savedSta
sessions: [...seeded.sessions, qualifyingSession, practiceSession],
});
const openSchedule = async () => {
const openSchedule = async (eventId = raceEvent.id) => {
await navigate("race_setup", "raceWizardStepForm");
await click("event-manage-" + raceEvent.id);
await click("event-manage-" + eventId);
await waitFor(async () => await evaluate(`Boolean(document.querySelector(".manage-tabs"))`), "manage tabs rendered");
await evaluate(`document.querySelector('[data-manage-tab="schedule"]').click()`);
await waitFor(async () => await evaluate(`Boolean(document.getElementById("scheduleForm"))`), "schedule panel visible");
@@ -84,4 +84,28 @@ export async function runEventScheduleSmoke({ evaluate, navigate, fill, savedSta
await openSchedule();
assert.equal(await evaluate(`Boolean(document.querySelector('[data-manage-panel="schedule"] table'))`), false, "with no start time set, the schedule table is replaced by the not-set hint");
console.log("PASS clearing the schedule removes the start time but keeps the configured gap");
// A race with a date (every race made in the app has one): the start time and gap are Race
// Day's for that date - one setting - and the table shows Race Day's times.
const dated = { ...raceEvent, id: "esc_event_dated", name: "ESC Dated", date: "2027-03-12" };
await patchState({
events: [...(await savedState()).events, dated],
sessions: [...(await savedState()).sessions,
{ id: "esc_dated_p", eventId: dated.id, name: "Dated Practice", type: "practice", durationMin: 5, status: "ready" },
{ id: "esc_dated_q", eventId: dated.id, name: "Dated Qualification", type: "qualification", durationMin: 5, status: "ready" }],
});
await openSchedule(dated.id);
await fill("scheduleForm", { scheduleStartTime: "10:00", scheduleGapMin: "4" });
await submit("scheduleForm");
const dayStart = new Date("2027-03-12T10:00").getTime();
await waitFor(async () => (await savedState()).raceDays?.find((day) => day.date === dated.date)?.startAt === dayStart, "Race setup saves Race Day's first start");
assert.equal((await savedState()).raceDays.find((day) => day.date === dated.date).gapMin, 4, "and its break between heats");
await openSchedule(dated.id);
const planned = await evaluate(`Array.from(document.querySelectorAll('[data-manage-panel="schedule"] table tbody tr td:nth-child(3)')).map((td) => td.textContent.trim())`);
assert.deepEqual(planned.map((text) => text.slice(0, 5)), ["10:00", "10:09"], "Race Day's times: 5 min heat + 4 min break");
// Changed in Race Day -> Race setup shows it.
await patchState({ raceDays: (await savedState()).raceDays.map((day) => (day.date === dated.date ? { ...day, startAt: new Date("2027-03-12T11:00").getTime() } : day)) });
await openSchedule(dated.id);
assert.equal(await evaluate(`document.querySelector('#scheduleForm [name="scheduleStartTime"]').value`), "11:00", "a first start changed in Race Day shows in Race setup");
console.log("PASS Race setup's start time and gap are Race Day's first start and break, and its table shows Race Day's times");
}