Skip to content

Commit

Permalink
#257 Show message to add custom screenshot (#268)
Browse files Browse the repository at this point in the history
* Show message to add custom screenshot #257

Signed-off-by: Nivedha <[email protected]>
Signed-off-by: NivedhaSenthil <[email protected]>

* #257 Fix test to show message

- when screenshot not available

Signed-off-by: NivedhaSenthil <[email protected]>
  • Loading branch information
NivedhaSenthil authored Jul 8, 2020
1 parent decc478 commit b3fedca
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 9 deletions.
8 changes: 7 additions & 1 deletion generator/generate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,13 @@ var wStepFailDiv = `<div class="error-container failed">
<pre>expected:&lt;foo [foo] foo&gt; but was:&lt;foo [bar] foo&gt;</pre>
</h4>
<pre class="stacktrace">stacktrace</pre>
</div>
</div>
<div class="screenshot-container custom-screenshot-message">
<div class="screenshot">
<p class="custom-message">To view a screenshot of this failed step, Please set up a <a href="https://docs.gauge.org/writing-specifications/#taking-custom-screenshots">custom screenshot handler.</a>
</p>
</div>
</div>
</div>
</div>`

Expand Down
10 changes: 10 additions & 0 deletions themes/default/assets/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -1509,4 +1509,14 @@ svg#pie-chart {
.report_test-results {
margin-top: 20px;
}
}

.custom-screenshot-message{
border: solid;
border-width: 1px;
}

.custom-message{
font-style: italic;
font-size: medium;
}
23 changes: 15 additions & 8 deletions themes/default/views/partials.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -565,20 +565,27 @@
</h4>
<pre class="stacktrace">{{.StackTrace | escapeHTML | encodeNewLine}}</pre>
</div>
{{ if .FailureScreenshotFile}}
{{ if not .FailureScreenshotFile}}
{{if .FailureScreenshot}}
<div class="screenshot-container">
<div class="screenshot">
<a href="{{toPath .BasePath (print "images/" .FailureScreenshotFile)}}" rel="lightbox">
<img src="{{toPath .BasePath (print "images/" .FailureScreenshotFile)}}" class="screenshot-thumbnail" />
<a href="data:image/png;base64,{{.FailureScreenshot}}" rel="lightbox">
<img src="data:image/png;base64,{{.FailureScreenshot}}" class="screenshot-thumbnail" />
</a>
</div>
</div>
{{end}}
{{if .FailureScreenshot}}
<div class="screenshot-container">
{{else}}
<div class="screenshot-container custom-screenshot-message">
<div class="screenshot">
<p class="custom-message">To view a screenshot of this failed step, Please set up a <a href="https://docs.gauge.org/writing-specifications/#taking-custom-screenshots">custom screenshot handler.</a></p>
</div>
</div>
{{end}}
{{else}}
<div class="screenshot-container">
<div class="screenshot">
<a href="data:image/png;base64,{{.FailureScreenshot}}" rel="lightbox">
<img src="data:image/png;base64,{{.FailureScreenshot}}" class="screenshot-thumbnail" />
<a href="{{toPath .BasePath (print "images/" .FailureScreenshotFile)}}" rel="lightbox">
<img src="{{toPath .BasePath (print "images/" .FailureScreenshotFile)}}" class="screenshot-thumbnail" />
</a>
</div>
</div>
Expand Down

0 comments on commit b3fedca

Please sign in to comment.