feat(series): rookie rounds can pick drivers from other classes, with a guide section (1.75.0)
This commit is contained in:
1 parent
bea4283130
commit
d5337e2cf3
11 files changed
+103
-9
No files matched your search
@@ -39,7 +39,7 @@ export async function runGuideTabsSmoke({ evaluate, navigate }) {
|
||||
// The series tab explains the whole series workflow, step by step.
|
||||
await evaluate(`document.querySelector('[data-guide-tab="series"]').click()`);
|
||||
const seriesText = await evaluate(`document.querySelector('[data-guide-panel="series"]').innerText`);
|
||||
assert.equal(await evaluate(`document.querySelectorAll('[data-guide-panel="series"] .guide-list li').length`), 21, "four sections, 21 steps");
|
||||
assert.equal(await evaluate(`document.querySelectorAll('[data-guide-panel="series"] .guide-list li').length`), 27, "five sections (with Rookie), 27 steps");
|
||||
assert.ok(!/guide\.series_/.test(seriesText), "every guide text is translated");
|
||||
assert.equal(await evaluate(`[...document.querySelectorAll("#guideOverview .guide-overview-card strong")].some((node) => /Serie|Series/.test(node.textContent))`), true, "the overview has a series card");
|
||||
console.log("PASS the guide has a Series / cup tab with the whole workflow");
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
// Rookie class in a series: the Rookie round offers drivers from other classes (2WD and 4WD
|
||||
// mixed) without registering them again, and a ticked rookie stays on the round's list.
|
||||
export async function runSeriesRookieSmoke({ evaluate, navigate, savedState, waitFor, base }) {
|
||||
const seeded = await savedState();
|
||||
const round = { id: "rk_round", name: "RK Cup #1 Rookie", date: "2026-03-01", classId: "rk_rookie", mode: "race", raceConfig: {} };
|
||||
await fetch(base + "/api/state", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({
|
||||
...seeded,
|
||||
classes: [...seeded.classes, { id: "rk_rookie", name: "RK Rookie" }, { id: "rk_2wd", name: "RK 2WD" }, { id: "rk_4wd", name: "RK 4WD" }],
|
||||
drivers: [...seeded.drivers, { id: "rk_ada", name: "RK Ada", classId: "rk_2wd", transponder: "8670001" }, { id: "rk_ben", name: "RK Ben", classId: "rk_4wd", transponder: "8670002" }],
|
||||
events: [...seeded.events, round],
|
||||
series: [...(seeded.series || []), { id: "rk_series", name: "RK Cup", classIds: ["rk_rookie"], eventIds: [round.id] }],
|
||||
}) });
|
||||
const driverIds = async () => (await savedState()).events.find((event) => event.id === round.id).raceConfig.driverIds || [];
|
||||
|
||||
await navigate("series", "seriesNew");
|
||||
await evaluate(`document.querySelector('[data-series-select="rk_series"]')?.click()`);
|
||||
await waitFor(async () => evaluate(`Boolean(document.querySelector('tr[data-round="rk_round"]'))`), "the Rookie round is listed");
|
||||
await evaluate(`document.querySelector('tr[data-round="rk_round"] [data-round-action="toggle"]').click()`);
|
||||
await waitFor(async () => evaluate(`Boolean(document.querySelector(".series-other-drivers[open]"))`), "drivers from other classes are offered (open, the class has none)");
|
||||
assert.match(await evaluate(`document.querySelector(".series-other-drivers").textContent`), /RK Ada[\s\S]*RK 2WD[\s\S]*RK Ben[\s\S]*RK 4WD/, "each with their own class");
|
||||
for (const id of ["rk_ada", "rk_ben"]) {
|
||||
await evaluate(`(() => { const box = document.querySelector('.series-other-drivers [data-round-driver="${id}"]'); box.checked = true; box.dispatchEvent(new Event("change")); })()`);
|
||||
await waitFor(async () => (await driverIds()).includes(id), `${id} ticked for the Rookie round`);
|
||||
}
|
||||
const state = await savedState();
|
||||
assert.deepEqual(state.drivers.filter((driver) => /^RK (Ada|Ben)$/.test(driver.name)).map((driver) => driver.id).sort(), ["rk_ada", "rk_ben"], "no driver registered again");
|
||||
await waitFor(async () => evaluate(`Boolean(document.querySelector('.series-round-participants > .series-class-list [data-round-driver="rk_ben"]:checked'))`), "a ticked rookie moves to the round's own list");
|
||||
console.log("PASS a Rookie round in a series takes 2WD and 4WD drivers from their own classes without registering them again");
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import { runPracticeResetSmoke } from "./browser_practice_reset.js";
|
||||
import { runPracticeRankingSmoke, runSpeakerPanelSmoke } from "./browser_practice_ranking.js";
|
||||
import { runJudgingAfterRaceSmoke } from "./browser_judging_after.js";
|
||||
import { runArchiveQualifyingSmoke } from "./browser_archive_qual.js";
|
||||
import { runSeriesRookieSmoke } from "./browser_series_rookie.js";
|
||||
import { runSuspectLapsSmoke } from "./browser_suspect_laps.js";
|
||||
import { runOverlayDriverLinkSmoke } from "./browser_overlay_driver_link.js";
|
||||
import { runProfileClassSmoke } from "./browser_profile_class.js";
|
||||
@@ -173,6 +174,7 @@ try {
|
||||
await runSpeakerPanelSmoke({ evaluate, navigate, savedState, waitFor });
|
||||
await runJudgingAfterRaceSmoke({ evaluate, navigate, savedState, waitFor, base, dialogs });
|
||||
await runArchiveQualifyingSmoke({ evaluate, navigate, savedState, waitFor, base });
|
||||
await runSeriesRookieSmoke({ evaluate, navigate, savedState, waitFor, base });
|
||||
await runSuspectLapsSmoke({ evaluate, navigate, savedState, waitFor, base, dialogs });
|
||||
await runOverlayDriverLinkSmoke({ evaluate, navigate, savedState, waitFor, base, send });
|
||||
await runDecoderClockSmoke({ evaluate, navigate, savedState, waitFor, base });
|
||||
|
||||
Reference in new issue
Block a user