Skip to content

Commit df93d71

Browse files
committed
closes #287
1 parent 2152160 commit df93d71

File tree

14 files changed

+68
-32
lines changed

14 files changed

+68
-32
lines changed

config/spark-config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"protocol": "HTTPS",
55
"timelineEnabled": false,
66
"offlineMode": true,
7+
"thumbnailForBase64": false,
78
"documentTitle": "ExtentReports",
89
"reportName": "ExtentReports",
910
"timeStampFormat": "MMM dd, yyyy HH:mm:ss a",

config/spark-config.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020

2121
<!-- offline report -->
2222
<enableOfflineMode>false</enableOfflineMode>
23+
24+
<!-- use thumbnails for base64 images -->
25+
<!-- this may slowdown viewing tests -->
26+
<thumbnailForBase64>false</thumbnailForBase64>
2327

2428
<!-- title of the document -->
2529
<documentTitle>Extent Framework</documentTitle>

src/main/java/com/aventstack/extentreports/reporter/configuration/ExtentSparkReporterConfig.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import lombok.Builder;
1111
import lombok.Getter;
1212
import lombok.Setter;
13+
import lombok.experimental.Accessors;
1314
import lombok.experimental.SuperBuilder;
1415

1516
/**
@@ -29,6 +30,8 @@ public class ExtentSparkReporterConfig extends InteractiveReporterConfig {
2930

3031
@Builder.Default
3132
private Boolean offlineMode = false;
33+
@Accessors(fluent = true) @Builder.Default
34+
private Boolean thumbnailForBase64 = false;
3235
@Builder.Default
3336
private String resourceCDN = "github";
3437

src/main/resources/com/aventstack/extentreports/offline/spark/css/spark-style.css

Lines changed: 5 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/resources/com/aventstack/extentreports/offline/spark/js/spark-script.js

Lines changed: 24 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/resources/com/aventstack/extentreports/templates/commons/commons-macros.ftl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,12 @@
3131
<#macro mediaSingle m>
3232
<#if m??>
3333
<div class="row mb-3"><div class="col-md-3">
34-
<#if m.base64??><a href="${m.base64}" data-featherlight="image"><span class="badge badge-gradient-primary">base64 img</span></a>
34+
<#if m.base64??>
35+
<#if config.thumbnailForBase64()?? && config.thumbnailForBase64()>
36+
<a href="${m.base64}" class="base64-img" data-featherlight="image"><img src=""></a>
37+
<#else>
38+
<a href="${m.base64}" data-featherlight="image"><span class="badge badge-gradient-primary">base64 img</span></a>
39+
</#if>
3540
<#elseif m.resolvedPath??><img data-featherlight='${m.resolvedPath}' src="${m.resolvedPath}">
3641
<#elseif m.path??><img data-featherlight='${m.path}' src="${m.path}">
3742
</#if>

src/main/resources/com/aventstack/extentreports/templates/spark/macros/recurse_nodes.ftl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
<#include "log.ftl">
22
<#macro recurse_nodes test>
33
<#if test.hasChildren()>
4-
<div class="accordion">
4+
<div class="accordion" role="tablist">
55
<#list test.children as node>
66
<div class="card">
77
<div class="card-header">
88
<div class="card-title">
9-
<div class="node" id="${node.getId()}">${node.name}</div>
10-
<div class="node-status float-right"><span class="badge ${node.status.toLower()}-bg log ">${node.status}</span></div>
11-
<div class="node-time">
12-
<span class='badge badge-default'>${node.timeTaken()?number_to_time?string("mm:ss:SSS")}</span>
9+
<div class="node-meta">
10+
<#if TestService.testHasScreenCapture(node, true)><span class='badge badge-default mr-1'><i class="fa fa-paperclip"></i></span></#if>
11+
<span class='badge badge-default mr-1'>${node.timeTaken()?number_to_time?string("mm:ss:SSS")}</span>
12+
<span class="badge ${node.status.toLower()}-bg log p-1">${node.status}</span>
1313
</div>
14+
<a class="node <#if !node.hasChildren() && node.status.toLower()!='fail'>collapsed</#if>" id="${node.getId()}">
15+
<span>${node.name}</span>
16+
</a>
1417
<div class="node-attr">
1518
<#if node.hasAttributes()><@attributes test=node /></#if>
1619
</div>
17-
<#if TestService.testHasScreenCapture(node, true)>
18-
<div class="status-avatar float-right"><i class="fa fa-paperclip"></i></div>
19-
</#if>
2020
</div>
2121
</div>
2222
<#if node.hasLog()>

src/main/resources/com/aventstack/extentreports/templates/spark/partials/head.ftl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<#assign
33
resourceCDN=config.resourceCDN
44
cdnURI="cdn.jsdelivr.net/gh/extent-framework/extent-github-cdn@"
5-
csscommit="c952cc003431b643d7a73337421ff42b75bac784"
6-
jscommit="14e9bb345ef7e2ed3a102f271d84e9f0267c88e7"
5+
csscommit="da49378e7c517e3ef85493e4c6d1280a9a61dbb3"
6+
jscommit="da49378e7c517e3ef85493e4c6d1280a9a61dbb3"
77
iconcommit="b00a2d0486596e73dd7326beacf352c639623a0e">
88
<#if resourceCDN=="extentreports">
99
<#assign

src/main/resources/com/aventstack/extentreports/templates/spark/partials/test.ftl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@
7070
<span class='badge badge-danger'>${test.endTime?string("MM.dd.yyyy HH:mm:ss")}</span>
7171
<span class='badge badge-default'>${test.timeTakenPretty()}</span>
7272
&middot; <span class='uri-anchor badge badge-default'>#test-id=${test.getId()}</span>
73+
<span class='badge badge-default pointer float-right ml-1 et'><i class="fa fa-chevron-down"></i></span>
74+
<span class='badge badge-default pointer float-right ct'><i class="fa fa-chevron-up"></i></span>
7375
</div>
7476
<#if test.hasAttributes()>
7577
<div class="m-t-15"><@attributes test=test /></div>

src/test/java/com/aventstack/extentreports/reporter/SparkReporterConfigTest.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010
import com.aventstack.extentreports.reporter.configuration.Theme;
1111

1212
public class SparkReporterConfigTest {
13+
private static final String FILE_PATH = "target/spark.html";
14+
1315
@Test
1416
public void configTest() {
15-
ExtentSparkReporter spark = new ExtentSparkReporter("target/spark.html");
17+
ExtentSparkReporter spark = new ExtentSparkReporter(FILE_PATH);
1618
spark.config(
1719
ExtentSparkReporterConfig.builder()
1820
.theme(Theme.DARK)
@@ -24,7 +26,7 @@ public void configTest() {
2426

2527
@Test
2628
public void loadJSONConfigFileTest() throws IOException {
27-
ExtentSparkReporter spark = new ExtentSparkReporter("target/spark.html");
29+
ExtentSparkReporter spark = new ExtentSparkReporter(FILE_PATH);
2830
spark.loadJSONConfig(new File("src/test/resources/config/spark-config.json"));
2931
Assert.assertEquals(spark.getConf().getTheme(), Theme.STANDARD);
3032
Assert.assertEquals(spark.getConf().getDocumentTitle(), "Test1");
@@ -34,7 +36,7 @@ public void loadJSONConfigFileTest() throws IOException {
3436
@Test
3537
public void loadJSONConfigStringTest() throws IOException {
3638
String json = "{ 'theme': 'DARK', 'documentTitle': 'Extent', 'encoding': 'utf-8' }";
37-
ExtentSparkReporter spark = new ExtentSparkReporter("target/spark.html");
39+
ExtentSparkReporter spark = new ExtentSparkReporter(FILE_PATH);
3840
spark.loadJSONConfig(json);
3941
Assert.assertEquals(spark.getConf().getTheme(), Theme.DARK);
4042
Assert.assertEquals(spark.getConf().getDocumentTitle(), "Extent");
@@ -43,7 +45,7 @@ public void loadJSONConfigStringTest() throws IOException {
4345

4446
@Test
4547
public void loadXMLConfigFileTest() throws IOException {
46-
ExtentSparkReporter spark = new ExtentSparkReporter("target/spark.html");
48+
ExtentSparkReporter spark = new ExtentSparkReporter(FILE_PATH);
4749
spark.loadXMLConfig(new File("src/test/resources/config/spark-config.xml"));
4850
Assert.assertEquals(spark.getConf().getReportName(), "Test2");
4951
Assert.assertEquals(spark.getConf().getDocumentTitle(), "Build 1");
@@ -52,7 +54,7 @@ public void loadXMLConfigFileTest() throws IOException {
5254

5355
@Test
5456
public void loadXMLConfigPathTest() throws IOException {
55-
ExtentSparkReporter spark = new ExtentSparkReporter("target/spark.html");
57+
ExtentSparkReporter spark = new ExtentSparkReporter(FILE_PATH);
5658
spark.loadXMLConfig("src/test/resources/config/spark-config.xml");
5759
Assert.assertEquals(spark.getConf().getReportName(), "Test2");
5860
Assert.assertEquals(spark.getConf().getDocumentTitle(), "Build 1");

0 commit comments

Comments
 (0)