feat: render results to HTML page after a CLI test run

This commit is contained in:
Aravinth Manivannan 2023-10-04 21:07:07 +05:30
parent 01844ed321
commit c293b46490
Signed by: realaravinth
GPG key ID: F8F50389936984FF

View file

@ -41,6 +41,7 @@ mod docker;
mod docker_compose; mod docker_compose;
mod errors; mod errors;
mod git; mod git;
mod pages;
mod runner; mod runner;
mod settings; mod settings;
mod utils; mod utils;
@ -114,11 +115,16 @@ async fn main() -> std::io::Result<()> {
suites: suite_results, suites: suite_results,
init_containers, init_containers,
}; };
let results_file = path.join("resuts.json"); let results_file = path.join("results.json");
println!("Writing results to: {:?}", path.canonicalize()); println!("Writing results to: {:?}", path.canonicalize());
std::fs::write(results_file, serde_json::to_string(&content).unwrap()).unwrap(); 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()); crate::runner::suite::SuiteRunnerState::stop_proxy(ctx.as_ref());
serv.stop(true).await; serv.stop(true).await;
Ok(()) Ok(())
} }