From 7d7c83616cc434f11a30b3e7f4577a55206cc76d Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 5 Nov 2026 20:26:42 +0100 Subject: dashboard: browser checks --- src/api/dashboard/mod.rs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/api/dashboard/mod.rs') diff --git a/src/api/dashboard/mod.rs b/src/api/dashboard/mod.rs index 4ba25c7..bea5493 100644 --- a/src/api/dashboard/mod.rs +++ b/src/api/dashboard/mod.rs @@ -760,6 +760,33 @@ fn snapshot_event(published: &Published) -> Event { mod tests { use super::*; + /// The page in a browser (`check.js`): it loads without errors, the peers table and + /// the map draw what the state says, and a large map doesn't hold the page up. + /// Needs Node.js with Playwright's library and its Chromium (`check.nix` gives them), + /// so only when asked: `cargo test --features dashboard dashboard_in_a_browser -- + /// --ignored`. + #[test] + #[ignore] + fn dashboard_in_a_browser() { + let file = + std::env::temp_dir().join(format!("continuum-dashboard-{}.html", std::process::id())); + std::fs::write(&file, &page().1).expect("page written"); + let check = + std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("src/api/dashboard/check.js"); + let status = std::process::Command::new("node") + .arg(&check) + .arg(&file) + .status() + .unwrap_or_else(|error| { + panic!( + "Node.js doesn't run ({error}): the browser checks need `node` on the \ + PATH, with Playwright's library and its Chromium (check.nix)" + ) + }); + let _ = std::fs::remove_file(&file); + assert!(status.success(), "the browser checks failed"); + } + #[test] fn merge_patches() { let old = json!({ "a": 1, "b": { "c": 2, "d": [1, 2] }, "gone": true }); -- cgit v1.3.1