docs(guide): team race, race overview, archive, practice ranking, speaker panel, sponsor flow and simulator (1.69.1)
This commit is contained in:
1 parent
eb4c472ef9
commit
2e3676d0cd
8 files changed
+112
-51
No files matched your search
@@ -39,14 +39,22 @@ export async function runDayScheduleSmoke({ evaluate, navigate, savedState, wait
|
||||
await evaluate(`(() => { const form = document.getElementById("dayPlanForm"); form.elements.startTime.value = ${JSON.stringify(hhmm(inAnHour))}; form.elements.gapMin.value = "2"; form.requestSubmit(); })()`);
|
||||
await waitFor(async () => Boolean(((await savedState()).raceDays || []).find((day) => day.date === today)?.startAt), "start time saved");
|
||||
const times = await evaluate(`[...document.querySelectorAll("[data-day-row] td:first-child strong")].map((cell) => cell.textContent)`);
|
||||
assert.equal(times[0], hhmm(inAnHour));
|
||||
assert.equal(times[1], hhmm(new Date(inAnHour.getTime() + 7 * 60000)));
|
||||
// Run in the last hour before midnight, "in an hour" is tomorrow: today's start time is then
|
||||
// already past and the schedule starts from now - only the gap can be checked.
|
||||
if (inAnHour.getDate() === new Date().getDate()) {
|
||||
assert.equal(times[0], hhmm(inAnHour));
|
||||
assert.equal(times[1], hhmm(new Date(inAnHour.getTime() + 7 * 60000)));
|
||||
} else {
|
||||
const minutes = (value) => Number(value.slice(0, 2)) * 60 + Number(value.slice(3, 5));
|
||||
assert.equal((minutes(times[1]) - minutes(times[0]) + 1440) % 1440, 7, "5 min heat + 2 min gap");
|
||||
}
|
||||
console.log("PASS the day gets a first start time and gap, and every heat its planned time");
|
||||
|
||||
await evaluate(`document.getElementById("dayAutopilotOn").click()`);
|
||||
await waitFor(async () => ((await savedState()).raceDays || []).find((day) => day.date === today)?.autopilot === true, "autopilot on");
|
||||
await waitFor(async () => (await evaluate(`document.querySelector("[data-autopilot-status]").textContent`)).startsWith("Next: 4WD") || (await evaluate(`document.querySelector("[data-autopilot-status]").textContent`)).includes("DS"), "the autopilot says what is next");
|
||||
assert.match(await evaluate(`document.querySelector("[data-autopilot-status]").textContent`), /^Next: .*Q1 H1 at /);
|
||||
// (Near midnight the first heat is already due, so the autopilot waits for the decoder instead.)
|
||||
assert.match(await evaluate(`document.querySelector("[data-autopilot-status]").textContent`), inAnHour.getDate() === new Date().getDate() ? /^Next: .*Q1 H1 at / : /Q1 H1/);
|
||||
// Time is up but no decoder: it waits and says why instead of starting.
|
||||
await evaluate(`(() => { const form = document.getElementById("dayPlanForm"); form.elements.startTime.value = ${JSON.stringify(hhmm(new Date(Date.now() - 60000)))}; form.requestSubmit(); })()`);
|
||||
await waitFor(async () => (await evaluate(`document.querySelector("[data-autopilot-status]").textContent`)).includes("decoder is not connected"), "waits for the decoder");
|
||||
|
||||
Reference in new issue
Block a user