Add waterfall to HTML report for a Hurl file.

This commit is contained in:
jcamiel 2023-06-07 14:51:12 +02:00
parent 8035b9bd8b
commit 927c6d69c4
No known key found for this signature in database
GPG Key ID: 07FF11CFD55356CC
5 changed files with 87 additions and 8 deletions

View File

@ -5,7 +5,7 @@ body {
}
.container {
max-width: 1200px;
max-width: 2000px;
width: 100%;
margin-left: auto;
margin-right: auto;
@ -19,6 +19,7 @@ body {
.report-nav-links {
display: flex;
margin-bottom: 20px;
font-weight: bold;
}
.report-nav a {
@ -26,6 +27,10 @@ body {
margin-right: 20px;
}
.report-nav a[aria-selected="true"] {
color: #ff0288;
}
.report-nav-summary > div {
display: flex;
}
@ -60,6 +65,10 @@ body {
}
.file-container {
max-width: 1200px;
width: 100%;
margin-left: auto;
margin-right: auto;
display: flex;
padding: 0;
border: solid 1px #dcdcde;

View File

@ -13,7 +13,7 @@
<div class="report-nav">
<div class="report-nav-links">
<div><a href="../index.html">Report</a></div>
<div><a href="{href_file}">File</a></div>
<div><a aria-selected="true" href="{href_file}">File</a></div>
<div><a href="{href_waterfall}">Waterfall</a></div>
</div>
<div class="report-nav-summary">
@ -25,10 +25,10 @@
</div>
<div class="errors">{errors}</div>
</div>
<div class="file-container">
<div class="line-numbers">{lines_div}</div>
<div class="file">{file_div}</div>
</div>
</div>
<div class="file-container">
<div class="line-numbers">{lines_div}</div>
<div class="file">{file_div}</div>
</div>
</div>
</body>

View File

@ -0,0 +1,45 @@
body {
font-family: "Helvetica Neue", Arial, sans-serif;
font-size: 1.125rem;
line-height: 1.4;
}
.container {
max-width: 2000px;
width: 100%;
margin-left: auto;
margin-right: auto;
}
.report-nav {
margin-top: 20px;
margin-bottom: 20px;
}
.report-nav-links {
display: flex;
margin-bottom: 20px;
font-weight: bold;
}
.report-nav a {
color: royalblue;
margin-right: 20px;
}
.report-nav a[aria-selected="true"] {
color: #ff0288;
}
.waterfall-container {
max-width: 2000px;
width: 100%;
margin-left: auto;
margin-right: auto;
border: solid 1px #dcdcde;
}
.waterfall {
overflow: auto;
overflow-y: hidden;
}

View File

@ -2,9 +2,24 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>{filename}</title>
<style>
{css}
</style>
<body>
<div>
{svg}
<div class="container">
<div class="report-nav">
<div class="report-nav-links">
<div><a href="../index.html">Report</a></div>
<div><a href="{href_file}">File</a></div>
<div><a aria-selected="true" href="{href_waterfall}">Waterfall</a></div>
</div>
</div>
</div>
<div class="waterfall-container">
<div class="waterfall">{svg}</div>
</div>
</div>
</body>
</html>

View File

@ -41,8 +41,18 @@ impl Testcase {
/// `hurl_file` AST is used to construct URL with line numbers to the correponding
/// entry in the colored HTML source file.
pub fn get_waterfall_html(&self, hurl_file: &HurlFile, entries: &[EntryResult]) -> String {
let href_file = format!("{}.html", self.id);
let href_waterfall = format!("{}-waterfall.html", self.id);
let css = include_str!("../resources/waterfall.css");
let svg = get_waterfall_svg(hurl_file, &self.id, entries);
format!(include_str!("../resources/waterfall.html"), svg = svg,)
format!(
include_str!("../resources/waterfall.html"),
filename = self.filename,
css = css,
svg = svg,
href_file = href_file,
href_waterfall = href_waterfall
)
}
}