Skip to content

Commit

Permalink
generate report and upload test results
Browse files Browse the repository at this point in the history
Signed-off-by: ShylajaDevadiga <shylaja@rancher.com>
  • Loading branch information
ShylajaDevadiga committed Jan 12, 2023
1 parent eb9e5ea commit 5eb466e
Show file tree
Hide file tree
Showing 5 changed files with 645 additions and 9 deletions.
7 changes: 5 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ require (
sigs.k8s.io/yaml v1.3.0
)

require (
github.com/aws/aws-sdk-go v1.44.116
github.com/spf13/cobra v1.6.0
)

require (
cloud.google.com/go v0.97.0 // indirect
cloud.google.com/go/storage v1.10.0 // indirect
Expand All @@ -151,7 +156,6 @@ require (
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e // indirect
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a // indirect
github.com/aws/aws-sdk-go v1.44.116 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
github.com/blang/semver v3.5.1+incompatible // indirect
Expand Down Expand Up @@ -315,7 +319,6 @@ require (
github.com/seccomp/libseccomp-golang v0.9.2-0.20220502022130-f33da4d89646 // indirect
github.com/shengdoushi/base58 v1.0.0 // indirect
github.com/soheilhy/cmux v0.1.5 // indirect
github.com/spf13/cobra v1.6.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stoewer/go-strcase v1.2.0 // indirect
github.com/stretchr/objx v0.4.0 // indirect
Expand Down
131 changes: 131 additions & 0 deletions tests/e2e/createreport/assets/report-template.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style type="text/css">
.root {
background-color: #232041;
color: white;
}

.successBackgroundColor {
background-color: darkgreen;
}

.failBackgroundColor {
background-color: darkred;
}

.skipBackgroundColor {
background-color: darkgrey;
}

.packageCardLayout {
grid-template-columns: 1fr auto auto auto;
grid-column-gap: 8px;
display: grid;
}

.testCardLayout {
grid-template-columns: 1fr auto auto;
display: grid;
width: 100%;
gap: 8px;
border-radius: 4px;
margin-bottom: 5px;
padding: 4px;
}

.collapsible {
cursor: pointer;
}

.collapsibleHeading {
color: white;
padding: 8px;
width: 100%;
border: none;
text-align: left;
outline: none;
font-size: 15px;
border-radius: 4px;
margin-bottom: 5px;
}

.collapsibleHeading:after {
content: '\002B';
}

.active:after {
content: "\2212";
}

.collapsibleHeadingContent {
padding: 0 18px;
max-height: 0;
overflow: hidden;
transition: max-height 0.2s ease-out;
}

.testStatsOverview {
grid-template-columns: 1fr 1fr 1fr auto;
display: grid;
}

.passedTests {
font-size: x-large;
color: green;
}

.failedTests {
font-size: x-large;
color: red;
}
.skippedTests {
font-size: x-large;
color: grey;
}
</style>
</head>
<body class="root">
<div style="display: flex; flex-direction: column; margin: 16px; height: 100vh">
<div style="font-size: x-large">Test Report</div>
<div style="font-size: large">Test Date: {{.TestDate}}</div>
<div class="testStatsOverview">
<p style="margin-top: 0;" class="passedTests">Passed tests: {{.PassedTests}}</p>
<p style="margin-top: 0;" class="failedTests">Failed tests: {{.FailedTests}}</p>
<p style="margin-top: 0;" class="skippedTests">Skipped tests: {{.SkippedTests}}</p>
<p style="font-size: x-large; margin-top: 0;">Total test time: {{.TotalTestTime}}</p>
</div>
{{range $index, $element := .HTMLElements}}
{{$element}}
{{end}}
</div>
</body>
<script>
// js script to create an collapsible
var coll = document.getElementsByClassName("collapsible");
for (let i = 0; i < coll.length; i++) {
var collapsibleHeading = undefined

for (let j = 0; j < coll[i].children.length; j++) {
let element = coll[i].children.item(j)
if (element.className.includes("collapsibleHeading")) {
collapsibleHeading = element
break
}
}

collapsibleHeading.addEventListener("click", function () {
this.classList.toggle("active")
var content = this.nextElementSibling;
if (content.style.maxHeight) {
content.style.maxHeight = null;
} else {
content.style.maxHeight = window.innerHeight + "px";
}
});
}
</script>
</html>
Loading

0 comments on commit 5eb466e

Please sign in to comment.