feat(training): Standard / Pro switch on the driver's page; purple day-best lap and stint consistency (1.87.0)
This commit is contained in:
1 parent
73e1c0ccf3
commit
0caf50254a
13 files changed
+204
-28
No files matched your search
@@ -39,4 +39,23 @@ export async function runProfileClassSmoke({ evaluate, savedState, waitFor, base
|
||||
assert.match(await evaluate(`location.search`), /class=pc_4wd/);
|
||||
assert.equal(await evaluate(`Boolean(document.querySelector("[data-switch-class]"))`), false);
|
||||
console.log("PASS on another class, the profile says the latest laps are in the 4WD and switches in one tap");
|
||||
|
||||
// Pro: a clean practice view with today's numbers and the stint cards only,
|
||||
// remembered on the phone and kept in the link.
|
||||
const visible = (selector) => evaluate(`(() => { const el = document.querySelector(${JSON.stringify(selector)}); return Boolean(el && el.offsetParent); })()`);
|
||||
assert.equal(await visible(".profile-pro"), false, "Standard by default");
|
||||
await evaluate(`document.querySelector('[data-profile-mode="pro"]').click()`);
|
||||
await waitFor(() => visible(".profile-pro"), "Pro view shown");
|
||||
assert.match(await evaluate(`location.search`), /mode=pro/);
|
||||
assert.equal(await visible(".profile-performance"), false, "stint statistics, goals and exercises are hidden");
|
||||
assert.equal(await visible(".profile-motivation-grid"), false);
|
||||
assert.equal(await evaluate(`document.querySelectorAll(".profile-pro .stint-laps-card").length`), 1, "today's stint");
|
||||
await evaluate(`document.querySelector(".profile-pro .stint-laps-card > summary").click()`);
|
||||
assert.equal(await evaluate(`document.querySelectorAll(".profile-pro .stint-lap").length`), 2, "both laps listed");
|
||||
await send("Page.navigate", { url: `${base}/public-training/${token}?lang=en` });
|
||||
await waitFor(() => visible(".profile-pro"), "the phone remembers Pro");
|
||||
await evaluate(`document.querySelector('[data-profile-mode="standard"]').click()`);
|
||||
await waitFor(async () => !(await visible(".profile-pro")) && (await visible(".profile-motivation-grid")), "back to Standard");
|
||||
assert.doesNotMatch(await evaluate(`location.search`), /mode=/);
|
||||
console.log("PASS the mobile profile has a Standard / Pro switch: Pro shows only today's numbers and the fold-out stints, and is remembered");
|
||||
}
|
||||
Reference in new issue
Block a user