From c293b4649039b451b1cd13258b05321da5c5af35 Mon Sep 17 00:00:00 2001 From: Aravinth Manivannan Date: Wed, 4 Oct 2023 21:07:07 +0530 Subject: [PATCH] feat: render results to HTML page after a CLI test run --- src/main.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index d6e7ffa..c6c639b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -41,6 +41,7 @@ mod docker; mod docker_compose; mod errors; mod git; +mod pages; mod runner; mod settings; mod utils; @@ -114,11 +115,16 @@ async fn main() -> std::io::Result<()> { suites: suite_results, init_containers, }; - let results_file = path.join("resuts.json"); + let results_file = path.join("results.json"); println!("Writing results to: {:?}", path.canonicalize()); std::fs::write(results_file, serde_json::to_string(&content).unwrap()).unwrap(); + let results_html_file = path.join("results.html"); + let contents = pages::ViewResult::new(pages::Payload { results: content }).render(); + std::fs::write(results_html_file, contents).unwrap(); + println!("Writing results to: {:?}", path.canonicalize()); crate::runner::suite::SuiteRunnerState::stop_proxy(ctx.as_ref()); + serv.stop(true).await; Ok(()) }