Skip to content

Commit 50bf98f

Browse files
committed
fixes #124
1 parent 4dcae3b commit 50bf98f

File tree

2 files changed

+133
-69
lines changed

2 files changed

+133
-69
lines changed
Lines changed: 83 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,92 @@
11
<div class="sr-filters bdd-filters">
2-
<a class="btn-floating waves-effect waves-light pass green" title="pass"><i class='material-icons'>${MaterialIcon.getIcon(Status.PASS)}</i></a>
3-
<a class="btn-floating waves-effect waves-light fail red" title="fail"><i class='material-icons'>${MaterialIcon.getIcon(Status.FAIL)}</i></a>
4-
<a class="btn-floating waves-effect waves-light skip blue" title="skip"><i class='material-icons'>${MaterialIcon.getIcon(Status.SKIP)}</i></a>
5-
<a class="btn-floating waves-effect waves-light clear grey" title="clear"><i class='material-icons'>clear</i></a>
2+
<a class="btn-floating waves-effect waves-light pass green" title="pass"><i class='material-icons'>${MaterialIcon.getIcon(Status.PASS)}</i></a>
3+
<a class="btn-floating waves-effect waves-light fail red" title="fail"><i class='material-icons'>${MaterialIcon.getIcon(Status.FAIL)}</i></a>
4+
<a class="btn-floating waves-effect waves-light skip blue" title="skip"><i class='material-icons'>${MaterialIcon.getIcon(Status.SKIP)}</i></a>
5+
<a class="btn-floating waves-effect waves-light clear grey" title="clear"><i class='material-icons'>clear</i></a>
66
</div>
77
<#if test.description?? && test.description?has_content>
88
<div class='test-desc'>${test.description}</div>
99
</#if>
1010
<#list test.nodeContext.all as node>
1111
<div class='${node.behaviorDrivenTypeName?lower_case} node' test-id='${node.getId()}' status='${node.status}'>
12-
<#if TestService.testHasCategory(node)>
13-
<div class='category-list'>
14-
<#list node.categoryContext.all as category>
15-
<span class='category label'>${category.name}</span>
16-
</#list>
17-
</div>
18-
</#if>
19-
<span class='duration right label'>${TestService.getRunDuration(node)}</span>
20-
<div class="bdd-test">
21-
<div class="scenario-name"><span class='status ${node.status}' title='${node.status}'><i class='material-icons'>${MaterialIcon.getIcon(node.status)}</i></span> ${node.behaviorDrivenTypeName}: ${node.name}</div>
22-
<#if TestService.testHasScreenCapture(node)>
23-
<ul class='screenshots right'>
24-
<#list node.screenCaptureContext.all as sc>
25-
<li><a data-featherlight="image" href="${sc.path}"><i class='material-icons'>panorama</i></a></li>
26-
</#list>
27-
</ul>
28-
</#if>
29-
<#if node.description?? && node.description?has_content>
30-
${node.description}
31-
</#if>
32-
</div>
33-
<#if TestService.testHasChildren(node)>
34-
<ul class='steps'>
35-
<#list node.nodeContext.all as child>
36-
<li test-id='${child.getId()}' class='node ${child.behaviorDrivenTypeName?lower_case} ${child.status}' status='${child.status}'>
37-
<div class="step-name" title="${child.description}"><span class='status ${child.status}' title='${child.status}'><i class='material-icons'>${MaterialIcon.getIcon(child.status)}</i></span>${child.name}</div>
38-
<#if TestService.testHasScreenCapture(child)>
39-
<ul class='screenshots right'>
40-
<#list child.screenCaptureContext.all as sc>
41-
<li><a data-featherlight="image" href="${sc.path}"><i class='material-icons'>panorama</i></a></li>
42-
</#list>
43-
</ul>
44-
</#if>
45-
<#list child.logContext.all as log>
46-
<#if log.exceptionInfo??>
47-
<textarea disabled class="code-block">${log.exceptionInfo.stackTrace}</textarea>
48-
<#else>
49-
<div class="node-step">${log.details}</div>
50-
</#if>
51-
</#list>
52-
<#if TestService.testHasChildren(child)>
53-
<ul class='gc steps'>
54-
<#list child.nodeContext.all as gc>
55-
<li test-id='${gc.getId()}' class='gc ${gc.behaviorDrivenTypeName?lower_case} ${gc.status}' status='${gc.status}'>
56-
<h6 class="step-name" title="${gc.description}"><span class='status ${gc.status}' title='${gc.status}'><i class='material-icons'>${MaterialIcon.getIcon(gc.status)}</i></span>${gc.name}</h6>
57-
<#if TestService.testHasScreenCapture(gc)>
58-
<ul class='screenshots right'>
59-
<#list gc.screenCaptureContext.all as sc>
60-
<li><a data-featherlight="image" href="${sc.path}"><i class='material-icons'>panorama</i></a></li>
61-
</#list>
62-
</ul>
63-
</#if>
64-
<#list gc.logContext.all as log>
65-
<#if log.exceptionInfo??><textarea disabled class="code-block">${log.exceptionInfo.stackTrace}</textarea>
66-
<#else><div class="node-step">${log.details}</div>
67-
</#if>
68-
</#list>
69-
</li>
70-
</#list>
71-
</ul>
72-
</#if>
73-
</li>
74-
</#list>
75-
</ul>
76-
</#if>
12+
<#if TestService.testHasCategory(node)>
13+
<div class='category-list'>
14+
<#list node.categoryContext.all as category>
15+
<span class='category label'>${category.name}</span>
16+
</#list>
17+
</div>
18+
</#if>
19+
<span class='duration right label'>${TestService.getRunDuration(node)}</span>
20+
<div class="bdd-test">
21+
<div class="scenario-name"><span class='status ${node.status}' title='${node.status}'><i class='material-icons'>${MaterialIcon.getIcon(node.status)}</i></span> ${node.behaviorDrivenTypeName}: ${node.name}</div>
22+
<#if TestService.testHasScreenCapture(node)>
23+
<ul class='screenshots right'>
24+
<#list node.screenCaptureContext.all as sc>
25+
<#if sc.path??>
26+
<li><a data-featherlight="image" href="${sc.path}"><i class='material-icons'>panorama</i></a></li>
27+
<#elseif sc.isBase64()>
28+
<li><a data-featherlight="image" href="${sc.base64String}"><i class='material-icons'>panorama</i></a></li>
29+
</#if>
30+
</#list>
31+
</ul>
32+
</#if>
33+
<#if node.description?? && node.description?has_content>
34+
${node.description}
35+
</#if>
36+
</div>
37+
<#if TestService.testHasChildren(node)>
38+
<ul class='steps'>
39+
<#list node.nodeContext.all as child>
40+
<li test-id='${child.getId()}' class='node ${child.behaviorDrivenTypeName?lower_case} ${child.status}' status='${child.status}'>
41+
<div class="step-name" title="${child.description}"><span class='status ${child.status}' title='${child.status}'><i class='material-icons'>${MaterialIcon.getIcon(child.status)}</i></span>${child.name}</div>
42+
<#if TestService.testHasScreenCapture(child)>
43+
<ul class='screenshots right'>
44+
<#list child.screenCaptureContext.all as sc>
45+
<#if sc.path??>
46+
<li><a data-featherlight="image" href="${sc.path}"><i class='material-icons'>panorama</i></a></li>
47+
<#elseif sc.isBase64()>
48+
<li><a data-featherlight="image" href="${sc.base64String}"><i class='material-icons'>panorama</i></a></li>
49+
</#if>
50+
</#list>
51+
</ul>
52+
</#if>
53+
<#list child.logContext.all as log>
54+
<#if log.exceptionInfo??>
55+
<textarea disabled class="code-block">${log.exceptionInfo.stackTrace}</textarea>
56+
<#else>
57+
<div class="node-step">${log.details}</div>
58+
</#if>
59+
</#list>
60+
<#if TestService.testHasChildren(child)>
61+
<ul class='gc steps'>
62+
<#list child.nodeContext.all as gc>
63+
<li test-id='${gc.getId()}' class='gc ${gc.behaviorDrivenTypeName?lower_case} ${gc.status}' status='${gc.status}'>
64+
<h6 class="step-name" title="${gc.description}"><span class='status ${gc.status}' title='${gc.status}'><i class='material-icons'>${MaterialIcon.getIcon(gc.status)}</i></span>${gc.name}</h6>
65+
<#if TestService.testHasScreenCapture(gc)>
66+
<ul class='screenshots right'>
67+
<#list gc.screenCaptureContext.all as sc>
68+
<#if sc.path??>
69+
<li><a data-featherlight="image" href="${sc.path}"><i class='material-icons'>panorama</i></a></li>
70+
<#elseif sc.isBase64>
71+
<li><a data-featherlight="image" href="${sc.base64String}"><i class='material-icons'>panorama</i></a></li>
72+
</#if>
73+
</#list>
74+
</ul>
75+
</#if>
76+
<#list gc.logContext.all as log>
77+
<#if log.exceptionInfo??>
78+
<textarea disabled class="code-block">${log.exceptionInfo.stackTrace}</textarea>
79+
<#else>
80+
<div class="node-step">${log.details}</div>
81+
</#if>
82+
</#list>
83+
</li>
84+
</#list>
85+
</ul>
86+
</#if>
87+
</li>
88+
</#list>
89+
</ul>
90+
</#if>
7791
</div>
7892
</#list>
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package com.aventstack.extentreports.reporter;
2+
3+
import org.testng.annotations.Test;
4+
5+
import com.aventstack.extentreports.ExtentReports;
6+
import com.aventstack.extentreports.gherkin.model.Feature;
7+
import com.aventstack.extentreports.gherkin.model.Given;
8+
import com.aventstack.extentreports.gherkin.model.Scenario;
9+
10+
public class Base64Tests {
11+
12+
private final static String BASE64 = "";
13+
14+
@Test
15+
public void testBase64BDDAtFeature() {
16+
ExtentReports extent = new ExtentReports();
17+
ExtentHtmlReporter html = new ExtentHtmlReporter("html/index.html");
18+
ExtentSparkReporter spark = new ExtentSparkReporter("spark/index.html");
19+
extent.attachReporter(html, spark);
20+
extent.createTest(Feature.class, "Feature")
21+
.addScreenCaptureFromBase64String(BASE64);
22+
extent.flush();
23+
}
24+
25+
@Test
26+
public void testBase64BDDAtScenario() {
27+
ExtentReports extent = new ExtentReports();
28+
ExtentHtmlReporter html = new ExtentHtmlReporter("html/index.html");
29+
ExtentSparkReporter spark = new ExtentSparkReporter("spark/index.html");
30+
extent.attachReporter(html, spark);
31+
extent.createTest(Feature.class, "Feature")
32+
.createNode(Scenario.class, "Scenario")
33+
.addScreenCaptureFromBase64String(BASE64);
34+
extent.flush();
35+
}
36+
37+
@Test
38+
public void testBase64BDDAtStep() {
39+
ExtentReports extent = new ExtentReports();
40+
ExtentHtmlReporter html = new ExtentHtmlReporter("html/index.html");
41+
ExtentSparkReporter spark = new ExtentSparkReporter("spark/index.html");
42+
extent.attachReporter(html, spark);
43+
extent.createTest(Feature.class, "Feature")
44+
.createNode(Scenario.class, "Scenario")
45+
.createNode(Given.class, "Given")
46+
.addScreenCaptureFromBase64String(BASE64);
47+
extent.flush();
48+
}
49+
50+
}

0 commit comments

Comments
 (0)