feat(race-setup): list sessions in running order and move them with up/down (1.49.0)

This commit is contained in:
larssand committed 2026-11-01 20:13:15 +01:00
1 parent e199f3aa1a
commit bb0fa7ede4
14 files changed
+104 -14

No files matched your search

+23
View File
@@ -84,4 +84,27 @@ export async function runRaceSetupSmoke({ evaluate, navigate, fill, savedState,
await click("team-delete-" + team.id);
await waitFor(async () => !(await raceState()).raceConfig.teams.some(item => item.id === team.id), "team deletion");
console.log("PASS race wizard/edit/reload, team create/member-edit/delete, session type/duration and lap limits");
// Running order: the sessions are listed in it, and ▲ moves one earlier.
for (const name of ["Q1 H2", "Q1 H1"]) {
await fill("sessionForm", { name, type: "qualification", durationMin: "5" });
await submit("sessionForm");
await waitFor(async () => (await savedState()).sessions.some((item) => item.name === name), name + " created");
}
const listed = async () => evaluate(`[...document.querySelectorAll("[data-session-move][data-step='1']")].map((button) => button.dataset.sessionMove)`);
const sessionNames = async () => {
const ids = await listed();
const all = (await savedState()).sessions;
return ids.map((id) => all.find((item) => item.id === id)?.name).filter((name) => /^Q1/.test(name));
};
await waitFor(async () => (await sessionNames()).join() === "Q1 H1,Q1 H2", "listed in running order although Q1 H1 was made last");
const q12 = (await savedState()).sessions.find((item) => item.name === "Q1 H2");
await evaluate(`document.querySelector('[data-session-move="${q12.id}"][data-step="-1"]').click()`);
await waitFor(async () => (await sessionNames()).join() === "Q1 H2,Q1 H1", "Q1 H2 moved up");
const q11 = (await savedState()).sessions.find((item) => item.name === "Q1 H1");
await waitFor(async () => {
const order = (await raceState()).sessionOrder || [];
return order.includes(q12.id) && order.indexOf(q12.id) < order.indexOf(q11.id);
}, "the order is saved on the race");
console.log("PASS Race Setup lists sessions in running order and ▲▼ change it");
}