connecton satus mobil profile

This commit is contained in:
larssand
2026-09-08 19:27:37 +02:00
parent 5559d74846
commit b3bec531de
11 changed files with 169 additions and 7 deletions

View File

@@ -133,6 +133,22 @@ try {
})()`);
console.log("PASS decoder diagnostics update without resetting settings draft");
await runOverlaySmoke({ evaluate });
const mobileState = await savedState();
const mobileToken = "browser-mobile-profile-token-1234567890";
mobileState.training ||= {};
mobileState.training.shares = [{ driverId: mobileState.drivers[0].id, token: mobileToken, enabled: true }];
const mobileSave = await fetch(base + "/api/state", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(mobileState) });
assert.ok(mobileSave.ok);
await send("Page.navigate", { url: base + "/public-training/" + mobileToken + "?lang=sv" });
await waitFor(async () => await evaluate('document.getElementById("publicTrainingConnection")?.dataset.state === "current"'), "mobile profile loaded");
await evaluate('window.mobileContentBeforeFailure = document.getElementById("publicTrainingRoot").firstElementChild');
await send("Network.emulateNetworkConditions", { offline: true, latency: 0, downloadThroughput: -1, uploadThroughput: -1 });
await waitFor(async () => await evaluate('document.getElementById("publicTrainingConnection")?.dataset.state === "failed"'), "mobile connection warning");
assert.ok(await evaluate('window.mobileContentBeforeFailure === document.getElementById("publicTrainingRoot").firstElementChild'));
await send("Network.emulateNetworkConditions", { offline: false, latency: 0, downloadThroughput: -1, uploadThroughput: -1 });
await evaluate('document.getElementById("publicTrainingRetry").click()');
await waitFor(async () => await evaluate('document.getElementById("publicTrainingConnection")?.dataset.state === "current"'), "mobile retry recovered");
console.log("PASS mobile offline status preserves profile nodes and retry recovers");
assert.deepEqual(errors, []);
console.log("PASS offline save failure, local draft retention, retry and confirmed saved status");
} finally {