fix(training): keep a linked driver until the first server load finishes
A ?driver= link to Training stats was cleared when the page rendered from the local copy before the server data arrived. The selection now survives until the first load settles, then the driver opens. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -26,6 +26,14 @@ export async function runTrainingSourceSmoke({ evaluate, navigate, savedState, w
|
||||
});
|
||||
|
||||
try {
|
||||
// A direct link to the driver: the page first renders from this browser's local copy, which
|
||||
// doesn't know the driver (created on the server) - the selection must survive until the
|
||||
// server data has loaded, then open that driver.
|
||||
await evaluate(`location.href = ${JSON.stringify(`${base}/?view=training&driver=ts_profile&class=ts_class`)}`);
|
||||
await waitFor(async () => (await evaluate(`document.getElementById("training-driver")?.value || ""`)) === "ts_profile", "the linked driver opens once the data has loaded");
|
||||
assert.match(await evaluate(`location.search`), /driver=ts_profile/, "the link is kept in the address");
|
||||
console.log("PASS a direct link to a driver's training stats opens that driver even before the data has loaded");
|
||||
|
||||
await navigate("training", "view");
|
||||
// The overview has its own driver picker; the driver page has another one.
|
||||
await waitFor(async () => Boolean(await evaluate(`[...document.querySelectorAll("#training-overview-driver option, #training-driver option")].some((option) => option.value === "ts_profile")`)), "driver listed");
|
||||
|
||||
Reference in New Issue
Block a user