From e8743e4d7c60617d22f2dda5f91c082e92922f55 Mon Sep 17 00:00:00 2001
From: Benjamin Bischoff <5775857+bischoffdev@users.noreply.github.com>
Date: Tue, 9 Jul 2024 13:29:09 +0200
Subject: [PATCH] 3.7.0 (#345)
* wip - custom favicon
* create img path
* default favicon works
* custom favicon definition
---
CHANGELOG.md | 8 +++
README.md | 5 ++
core/README.md | 15 ++++
core/pom.xml | 4 +-
.../cluecumber/core/CluecumberCore.java | 14 ++++
documentation/img/custom_favicon.png | Bin 0 -> 4817 bytes
engine/README.md | 3 +-
engine/pom.xml | 4 +-
.../cluecumber/engine/CluecumberEngine.java | 7 ++
.../engine/properties/PropertyManager.java | 60 ++++++++++++++--
.../engine/rendering/ReportGenerator.java | 18 ++++-
.../main/resources/template/img/favicon.png | Bin 0 -> 1942 bytes
.../main/resources/template/macros/page.ftl | 1 +
.../engine/rendering/ReportGeneratorTest.java | 4 +-
examples/maven-example/custom/favicon.png | Bin 0 -> 1152 bytes
examples/maven-example/pom.xml | 5 +-
makefile | 6 +-
maven/README.md | 64 +++++++++++++++---
maven/pom.xml | 4 +-
.../cluecumber/maven/CluecumberMaven.java | 7 ++
pom.xml | 2 +-
21 files changed, 197 insertions(+), 34 deletions(-)
create mode 100644 documentation/img/custom_favicon.png
create mode 100644 engine/src/main/resources/template/img/favicon.png
create mode 100644 examples/maven-example/custom/favicon.png
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 87c6956f..2e9ccb75 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
Back to [Readme](README.md).
+## [3.7.0] - 2024-07-09
+
+### Added
+
+* Custom favicon definition through property (#340)
+
## [3.6.3] - 2024-06-10
### Changed
@@ -877,6 +883,8 @@ the core component is now the reporting engine that is the base for other forms
Initial project version on GitHub and Maven Central.
+[3.7.0]: https://github.com/trivago/cluecumber-report-plugin/tree/v3.7.0
+
[3.6.3]: https://github.com/trivago/cluecumber-report-plugin/tree/v3.6.3
[3.6.2]: https://github.com/trivago/cluecumber-report-plugin/tree/v3.6.2
diff --git a/README.md b/README.md
index 88d8a6ce..a532a51c 100644
--- a/README.md
+++ b/README.md
@@ -15,6 +15,11 @@ Cluecumber comes in two flavors:
* [__Cluecumber Core__](core) - generates reports from Java code
* [__Cluecumber Maven__](maven) - generates reports from Maven
+The look can be adjusted by setting
+* optional custom CSS
+* optional custom favicon
+* Custom parameters
+
![Cluecumber animation](documentation/img/cluecumber.gif)
A fully generated example report can be [viewed here](https://softwaretester.blog/cluecumber)!
diff --git a/core/README.md b/core/README.md
index 3998842f..47b83b6f 100644
--- a/core/README.md
+++ b/core/README.md
@@ -30,6 +30,7 @@ _Clear and concise JVM reporting for the Cucumber BDD JSON format_
- [Defining the report start page](#defining-the-report-start-page)
- [Defining a custom report title](#defining-a-custom-report-title)
- [Defining a custom CSS file](#defining-a-custom-css-file)
+ - [Defining a custom favicon](#defining-a-custom-favicon)
- [Defining custom passed, skipped and failed colors](#defining-custom-passed-skipped-and-failed-colors)
- [Enabling a compact view of multiple runs of the same scenarios](#enabling-a-compact-view-of-multiple-runs-of-the-same-scenarios)
- [Appendix](#appendix)
@@ -345,6 +346,20 @@ Likewise, if you want to hide elements from the report, you can also add this to
}
```
+
+## Defining a custom favicon
+
+The favicon is displayed in the browser tab and can be customized by setting the `customFavicon` property. This must be
+a png file of size 16x16 or 32x32 pixels
+
+![Custom Favicon](../documentation/img/custom_favicon.png)
+
+```java
+new CluecumberCore.Builder()
+ .setCustomFavicon("custom/favicon.png")
+ .build().generateReports(jsonDirectory, reportDirectory);
+```
+
## Defining custom passed, skipped and failed colors
It is possible to set these properties to change the color scheme for passed, failed and skipped steps and scenarios
diff --git a/core/pom.xml b/core/pom.xml
index 56546ce6..46e29b4c 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -6,13 +6,13 @@
4.0.0cluecumber-core
- 3.6.3
+ 3.7.0jarcluecumber-parentcom.trivago.rta
- 3.6.3
+ 3.7.0Cluecumber Core
diff --git a/core/src/main/java/com/trivago/cluecumber/core/CluecumberCore.java b/core/src/main/java/com/trivago/cluecumber/core/CluecumberCore.java
index 3bddb122..b1d42b23 100644
--- a/core/src/main/java/com/trivago/cluecumber/core/CluecumberCore.java
+++ b/core/src/main/java/com/trivago/cluecumber/core/CluecumberCore.java
@@ -32,12 +32,14 @@ public class CluecumberCore {
/**
* The constructor for the Cluecumber core.
+ *
* @param builder The builder instance.
* @throws CluecumberException Thrown in case of any error.
*/
private CluecumberCore(Builder builder) throws CluecumberException {
cluecumberEngine = DaggerCluecumberCoreGraph.create().getCluecumberEngine();
cluecumberEngine.setCustomCssFile(builder.customCssFile);
+ cluecumberEngine.setCustomFavicon(builder.customFavicon);
cluecumberEngine.setCustomNavigationLinks(builder.customNavigationLinks);
cluecumberEngine.setCustomPageTitle(builder.customPageTitle);
cluecumberEngine.setCustomParameters(builder.customParameters);
@@ -75,6 +77,7 @@ public void generateReports(final String jsonDirectory, final String reportDirec
*/
public static class Builder {
private String customCssFile;
+ private String customFavicon;
private LinkedHashMap customNavigationLinks;
private String customPageTitle;
private LinkedHashMap customParameters;
@@ -116,6 +119,17 @@ public Builder setCustomCssFile(final String customCssFile) {
return this;
}
+ /**
+ * Custom favicon to display in the browser tab.
+ *
+ * @param customFavicon The path to a favicon png file.
+ * @return The {@link Builder}.
+ */
+ public Builder setCustomFaviconFile(final String customFavicon) {
+ this.customFavicon = customFavicon;
+ return this;
+ }
+
/**
* Custom navigation links to display at the end of the default navigation.
*
diff --git a/documentation/img/custom_favicon.png b/documentation/img/custom_favicon.png
new file mode 100644
index 0000000000000000000000000000000000000000..bcd36a342f5d9666c67620c897ae33d1d4137cca
GIT binary patch
literal 4817
zcmZWt2RK}7&{m@pTvjiu*Hx~zR=3!MSY7nCt`(N7E=q(AA_xhIh}A<1Qq)9`B_dWY
zQ4^vIyL$Jpd+&emeg6ME&zza>n|WuxnR&i*&UcdG*NmCydFaW=$e3Uz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n8sSo;He=b_5>FWvyR*DEYotBr_
zCFqRx74YQilYPf(FE-DRJpwk7Gwxam!);hiI&kSGk%)y?t1EW%m1(s7gKDqXXKf+t
z#Wf)v?8PU9W^b{Jm?OGEHV_K^8G&BVf`5r)n%GL}Py7q#55@}5ZBnIPSx8g;Mp4@N
z;nBg*HyH;<0V!uj0N>;fIXsrH$%(;F-VuBcC8=IYQ`F#Y`5YGFbmY%?sq#*a>av%%
zE>X-0v-R2~co0#V>0=^-bT-+|FR^G96h?Q&Dl2MhQ2K01s&1C~y$T0ZfOrpF_vVZm
zLmd}IgeV2z&CFm~>Gl);p_p7!!f+gG;N$wXeZBg7P9EZOtX@QU^2F)5b8_#(@cluecumber-parentcom.trivago.rta
- 3.6.3
+ 3.7.0cluecumber-engine
- 3.6.3
+ 3.7.0jarCluecumber Engine
diff --git a/engine/src/main/java/com/trivago/cluecumber/engine/CluecumberEngine.java b/engine/src/main/java/com/trivago/cluecumber/engine/CluecumberEngine.java
index a6e95172..c80b1061 100644
--- a/engine/src/main/java/com/trivago/cluecumber/engine/CluecumberEngine.java
+++ b/engine/src/main/java/com/trivago/cluecumber/engine/CluecumberEngine.java
@@ -284,6 +284,13 @@ public void setCustomCssFile(final String customCss) throws MissingFileException
propertyManager.setCustomCssFile(customCss);
}
+ public void setCustomFavicon(final String customFavicon) throws MissingFileException {
+ if (customFavicon == null) {
+ return;
+ }
+ propertyManager.setCustomFaviconFile(customFavicon);
+ }
+
/**
* Set a custom color for passed scenarios.
*
diff --git a/engine/src/main/java/com/trivago/cluecumber/engine/properties/PropertyManager.java b/engine/src/main/java/com/trivago/cluecumber/engine/properties/PropertyManager.java
index 0b4fe8e8..09f6ce4e 100644
--- a/engine/src/main/java/com/trivago/cluecumber/engine/properties/PropertyManager.java
+++ b/engine/src/main/java/com/trivago/cluecumber/engine/properties/PropertyManager.java
@@ -62,6 +62,7 @@ public class PropertyManager {
private boolean groupPreviousScenarioRuns = false;
private boolean expandPreviousScenarioRuns = false;
private String customCssFile;
+ private String customFaviconFile;
private String customParametersFile;
private Settings.CustomParamDisplayMode customParametersDisplayMode =
Settings.CustomParamDisplayMode.ALL_PAGES;
@@ -128,7 +129,8 @@ public String getGeneratedHtmlReportDirectory() {
* @param generatedHtmlReportDirectory The path.
* @throws WrongOrMissingPropertyException Thrown on any error.
*/
- public void setGeneratedHtmlReportDirectory(final String generatedHtmlReportDirectory) throws WrongOrMissingPropertyException {
+ public void setGeneratedHtmlReportDirectory(final String generatedHtmlReportDirectory)
+ throws WrongOrMissingPropertyException {
if (!isSet(generatedHtmlReportDirectory)) {
throw new WrongOrMissingPropertyException("generatedHtmlReportDirectory");
}
@@ -197,7 +199,8 @@ public Settings.CustomParamDisplayMode getCustomParametersDisplayMode() {
*/
public void setCustomParametersDisplayMode(String customParametersDisplayMode) {
try {
- this.customParametersDisplayMode = Settings.CustomParamDisplayMode.valueOf(customParametersDisplayMode.toUpperCase());
+ this.customParametersDisplayMode =
+ Settings.CustomParamDisplayMode.valueOf(customParametersDisplayMode.toUpperCase());
} catch (IllegalArgumentException e) {
logger.warn("Unknown setting for custom parameter page(s): '" + customParametersDisplayMode +
"'. Must be one of " + Arrays.toString(Settings.CustomParamDisplayMode.values()));
@@ -422,6 +425,31 @@ public void setCustomCssFile(final String customCssFile) throws MissingFileExcep
}
}
+ /**
+ * Get the custom favicon file path.
+ *
+ * @return The path.
+ */
+ public String getCustomFaviconFile() {
+ return customFaviconFile;
+ }
+
+ /**
+ * Set the custom favicon file path.
+ *
+ * @param customFaviconFile The path.
+ * @throws MissingFileException Thrown if the file is not found.
+ */
+ public void setCustomFaviconFile(final String customFaviconFile) throws MissingFileException {
+ this.customFaviconFile = customFaviconFile;
+ if (!isSet(customFaviconFile)) {
+ return;
+ }
+ if (!fileIO.isExistingFile(customFaviconFile)) {
+ throw new MissingFileException(customFaviconFile + " (customFaviconFile)");
+ }
+ }
+
/**
* Get the custom hex color for passed elements.
*
@@ -523,7 +551,9 @@ public void logProperties() {
logger.logInfoSeparator();
}
customParameters.entrySet().stream().map(entry -> "- custom parameter : " +
- entry.getKey() + " -> " + entry.getValue()).forEach(logString -> logger.info(logString, DEFAULT));
+ entry.getKey() + " -> " +
+ entry.getValue()).forEach(
+ logString -> logger.info(logString, DEFAULT));
}
logger.logInfoSeparator(DEFAULT);
@@ -548,22 +578,37 @@ public void logProperties() {
logString -> logger.info(logString, DEFAULT));
}
-
if (isSet(customCssFile)) {
logger.info("- custom CSS file : " + customCssFile, DEFAULT);
}
+ if (isSet(customFaviconFile)) {
+ logger.info("- custom favicon file : " + customFaviconFile, DEFAULT);
+ }
logger.info("- colors (passed, failed, skipped) : " +
customStatusColorPassed + ", " + customStatusColorFailed + ", " + customStatusColorSkipped, DEFAULT);
-
logger.logInfoSeparator(DEFAULT);
}
+ /**
+ * Check if a string is set.
+ *
+ * @param string The string to check.
+ * @return true if the string is set.
+ */
private boolean isSet(final String string) {
return string != null && !string.trim().isEmpty();
}
- private void checkHexColorValidity(String color, String colorPropertyName) throws WrongOrMissingPropertyException {
+ /**
+ * Check if a hex color is valid.
+ *
+ * @param color The color string.
+ * @param colorPropertyName The name of the color property.
+ * @throws WrongOrMissingPropertyException Thrown if the color is invalid.
+ */
+ private void checkHexColorValidity(String color, String colorPropertyName)
+ throws WrongOrMissingPropertyException {
if (!Pattern.compile(COLOR_PATTERN).matcher(color).matches()) {
throw new WrongOrMissingPropertyException(colorPropertyName);
}
@@ -587,7 +632,8 @@ public void setStartPage(final String startPage) {
try {
this.startPage = Settings.StartPage.valueOf(startPage.toUpperCase());
} catch (IllegalArgumentException e) {
- logger.warn("Unknown start page '" + startPage + "'. Must be one of " + Arrays.toString(Settings.StartPage.values()));
+ logger.warn("Unknown start page '" + startPage + "'. Must be one of " +
+ Arrays.toString(Settings.StartPage.values()));
this.startPage = Settings.StartPage.ALL_SCENARIOS;
}
}
diff --git a/engine/src/main/java/com/trivago/cluecumber/engine/rendering/ReportGenerator.java b/engine/src/main/java/com/trivago/cluecumber/engine/rendering/ReportGenerator.java
index 429269db..fabb5859 100644
--- a/engine/src/main/java/com/trivago/cluecumber/engine/rendering/ReportGenerator.java
+++ b/engine/src/main/java/com/trivago/cluecumber/engine/rendering/ReportGenerator.java
@@ -92,10 +92,11 @@ public void generateReport(final AllScenariosPageCollection allScenariosPageColl
createDirectories(reportDirectory);
copyStaticReportAssets(reportDirectory);
copyCustomCss(reportDirectory);
+ copyCustomFavicon(reportDirectory);
boolean redirectToFirstScenarioPage =
propertyManager.getStartPage() == Settings.StartPage.ALL_SCENARIOS &&
- allScenariosPageCollection.getTotalNumberOfScenarios() == 1;
+ allScenariosPageCollection.getTotalNumberOfScenarios() == 1;
generateStartPage(redirectToFirstScenarioPage);
for (PageVisitor visitor : visitors) {
@@ -148,12 +149,27 @@ private void copyCustomCss(final String reportDirectory) throws CluecumberExcept
), reportDirectory + "/css/cluecumber-custom.css");
}
+ /**
+ * Copy custom favicon to the specified target directory.
+ */
+ private void copyCustomFavicon(final String reportDirectory) throws CluecumberException {
+ String customFavicon = propertyManager.getCustomFaviconFile();
+ if (customFavicon != null && !customFavicon.isEmpty()) {
+ fileSystemManager.copyResource(customFavicon, reportDirectory + "/img/favicon.png");
+ } else {
+ copyFileFromJarToReportDirectory("/img/favicon.png");
+ }
+ }
+
/**
* Copy all needed static report assets to the specified target directory.
*
* @throws CluecumberException The {@link CluecumberException}.
*/
private void copyStaticReportAssets(final String reportDirectory) throws CluecumberException {
+ // Copy image resources
+ fileSystemManager.createDirectory(reportDirectory + "/img");
+
// Copy CSS resources
fileSystemManager.createDirectory(reportDirectory + "/css");
copyFileFromJarToReportDirectory("/css/bootstrap.min.css");
diff --git a/engine/src/main/resources/template/img/favicon.png b/engine/src/main/resources/template/img/favicon.png
new file mode 100644
index 0000000000000000000000000000000000000000..2635d3ce863976590c4ebfdc7367ead6ec56957f
GIT binary patch
literal 1942
zcmV;H2Wj|;P)oF3`T3{((Jhhc>2m-8N
zt!-1LFQ3ru-{?r|Y%H?@qe^34BT`^WPS6|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&$b~w
z@Y;pP&)Tvl3Xmhp1W8mvlbQL;U!GsI;eA-Rmyie)l7^}HrT5Lh|NQRM5(HFW1jT--
zK`#Vec(;QbG$6=83TojEl#m1HOuxSE^i~^LyEIC&_2LO<(jxuaH;f6M2x~@n8VH!6q^hyff?ex;=#wW^Cu&+mtVsw1
zJmCq&y7RyiZfF`%NMfv5aNi^z{LI;DOM0npf*D}I`N+dCI=8iP@rFP8*?0EllD@^-
zK!6gdbz6kJR~Q1Qz-XwBvUTZ2_{HJnp3S;YGm1z;0Kn7d&VnG6AOuf!S~&I6iT?1P
zcD}wa@QfK!Fs{J^Qpz+onM4+*U3Y2x{I+`i?xs(ldvU<>e0AjM`5X`-0hur)6%AsF
z@m$o0j@VC*)T47-3@FB0gCMC$bxlES-?ugW!3~Sg9jHxP>WJ_*tSFKIXa@4kd@jk5
z>lU6Ml^&R2;k9hnSdHVuZsWhD*ylh
literal 0
HcmV?d00001
diff --git a/engine/src/main/resources/template/macros/page.ftl b/engine/src/main/resources/template/macros/page.ftl
index 60e172b6..f9f2d24d 100644
--- a/engine/src/main/resources/template/macros/page.ftl
+++ b/engine/src/main/resources/template/macros/page.ftl
@@ -35,6 +35,7 @@ limitations under the License.
${title}
+
<#include "../snippets/common_headers.ftl">
<#include "../snippets/css.ftl">
<#include "../snippets/js.ftl">
diff --git a/engine/src/test/java/com/trivago/cluecumber/engine/rendering/ReportGeneratorTest.java b/engine/src/test/java/com/trivago/cluecumber/engine/rendering/ReportGeneratorTest.java
index 9df57dbd..d51419dd 100644
--- a/engine/src/test/java/com/trivago/cluecumber/engine/rendering/ReportGeneratorTest.java
+++ b/engine/src/test/java/com/trivago/cluecumber/engine/rendering/ReportGeneratorTest.java
@@ -92,7 +92,7 @@ public void fileOperationsTest() throws CluecumberException {
reportGenerator.generateReport(allScenariosPageCollection);
- verify(fileSystemManager, times(8)).createDirectory(anyString());
- verify(fileSystemManager, times(17)).copyResourceFromJar(anyString(), anyString());
+ verify(fileSystemManager, times(9)).createDirectory(anyString());
+ verify(fileSystemManager, times(18)).copyResourceFromJar(anyString(), anyString());
}
}
diff --git a/examples/maven-example/custom/favicon.png b/examples/maven-example/custom/favicon.png
new file mode 100644
index 0000000000000000000000000000000000000000..da5d1b99dd787ba961eaa95a786753129d15834b
GIT binary patch
literal 1152
zcmV-`1b_R9P)Nkl^Pn{cAPp+6We)`fb&pjP}LxpG%7+uLaIP4c?cmzNK~p+*t81}
zVnY{D3D_Z6@Gc-&m6nR2q^XoNX-s0LjgvZYGO<0eCw|P#y)4o;3YokmR{YDEbN}x?
z&OPTMP?LtC%l##uF78N&-B!bzZ43ZpQ@NGt?A$PacW{}X&d3Etb?m={wtjLwR{He2
zO|~kQW@v&40stTzkp#(kg`Zvh?fe)&wYoomhM~G%t9#<58jX$?;^OS!^89d;pUUI}
z2>?ts#?feTx0h8P1e{>zvDT)MOS&H{nNguq8KzFw!N+aCQrv9?m&7QmRb{qMIC
z0^hzdv@)ID-Tk3bF_9qR?JO^Eu}pk_Uv<$GLU8aco8v3gg84rCrvoH5Y8vZ;22tpT{wR&0wP|;+i5Ow>Tx$JWOV1Tfs;{<`90DFDLNu_}NP
zm!2q4$jFBQhJB)vAuankNd^Dp1h>xWah02bqB*5O)aN3O!
zN=DUIFgL;jpw=@UgbsKNX3oI*EC3`qt5V0P#JC_SlDpMb8MGY?;5%7CQvg5;tJ2oL
zw3Jf-z|(Fwa?IpU_xI~g>!?!~+w?30h^h>hE={dw7dPEm8UPl?(*Ay@tD!WPDJCWa
z*r@|s}Mpx
z1A&(3JcxoqR?+AvKtOBg>MpMCq%$28(=ibqb+q){nk*^aZihcqk;_VaII}~`1OV1)
zIDWRi?FBC;A^^Et#*+u|ZiVEMo
zelxq2Q+2QJtL#1Bq&Mp%Nxt&d&6z)z*LT%qV@`h*bT```ymAOqu)HZX5rupq=aX;x
zOWh_cllhV4!dPl0lF21yN`s7?)=_V%YA-9RWdTU^+T!5lNMd4ByVvOHK%cAYl{%}-
zw2o29eVs|uGZ64U!c8NIf&-3DqI`oufUfsjk9+or}L
z1Z;(o^RbmJHrr8?)blog.softwaretester
maven-example
- 3.6.3
+ 3.7.0pom
@@ -74,6 +74,9 @@
+
+
+
falsetrue
diff --git a/makefile b/makefile
index 7034a234..0e1d1ce4 100644
--- a/makefile
+++ b/makefile
@@ -1,8 +1,8 @@
build-and-test:
mvn clean install
- mvn verify -f=examples/maven-example -e
+ (cd examples/maven-example && mvn verify -e)
open examples/maven-example/target/cluecumber-report/pages/scenario-detail/scenario_1.html
show-versions:
- mvn versions:display-dependency-updates
- mvn versions:display-plugin-updates
\ No newline at end of file
+ mvn versions:display-dependency-updates -U -ntp
+ mvn versions:display-plugin-updates -U -ntp
\ No newline at end of file
diff --git a/maven/README.md b/maven/README.md
index e689db1a..7b843ddd 100644
--- a/maven/README.md
+++ b/maven/README.md
@@ -6,6 +6,7 @@
# Cluecumber Maven
+
_Clear and concise Maven reporting for the Cucumber BDD JSON format_
@@ -32,6 +33,7 @@ _Clear and concise Maven reporting for the Cucumber BDD JSON format_
- [Defining the report start page](#defining-the-report-start-page)
- [Defining a custom report title](#defining-a-custom-report-title)
- [Defining a custom CSS file](#defining-a-custom-css-file)
+ - [Defining a custom favicon](#defining-a-custom-favicon)
- [Defining custom passed, skipped and failed colors](#defining-custom-passed-skipped-and-failed-colors)
- [Enabling a compact view of multiple runs of the same scenarios](#enabling-a-compact-view-of-multiple-runs-of-the-same-scenarios)
- [Running the reporting goal directly via command line](#running-the-reporting-goal-directly-via-command-line)
@@ -46,6 +48,7 @@ _Clear and concise Maven reporting for the Cucumber BDD JSON format_
# Maven POM settings
```xml
+
com.trivago.rtacluecumber-maven
@@ -73,7 +76,7 @@ your Cucumber runner configuration:
```java
@CucumberOptions(
- plugin = {"json:target/cucumber-report/cucumber.json"}
+ plugin = {"json:target/cucumber-report/cucumber.json"}
)
```
@@ -91,6 +94,7 @@ __Note:__ Typically, both properties point to directories inside the Maven ```ta
This specifies the source folder of the Cucumber JSON result files.
```xml
+
c:/example/json-files
...
@@ -102,6 +106,7 @@ This specifies the source folder of the Cucumber JSON result files.
This points to the root directory of the generated Cluecumber HTML report.
```xml
+
c:/example/my-report
...
@@ -121,6 +126,7 @@ By default, Cluecumber logs all information including
This can be configured by passing the `logLevel` property:
```xml
+
default|compact|minimal|off
```
@@ -140,6 +146,7 @@ Valid URLs that start with a protocol (http, https, ftp) are automatically recog
If a parameter name starts with an underscore (`_`), only the value is displayed.
```xml
+
This is a test
@@ -162,6 +169,7 @@ You can also set custom parameters by specifying the path to a `.properties` fil
like this:
```xml
+
path/to/your/customParameters.properties
...
@@ -194,6 +202,7 @@ The following display modes are available for displaying the custom parameters:
* `ALL_PAGES`: Display on all the pages in the report.
```xml
+
ALL_PAGES
...
@@ -208,6 +217,7 @@ If you have other pages or files you want to make accessible from the central na
this is possible via the `customNavigationLinks` property.
```xml
+
https://www.softwaretester.blog
@@ -226,6 +236,7 @@ these are replaces with spaces for the link name:
The `skip` property is used to skip the report generation completely. The default value is `false`
```xml
+
true
...
@@ -239,6 +250,7 @@ as `failed` when they contain `pending` or `skipped` steps.
The default setting is `false`, meaning that those scenarios will be marked as `skipped`.
```xml
+
true
...
@@ -247,13 +259,17 @@ The default setting is `false`, meaning that those scenarios will be marked as `
## Auto-expand Certain Report Sections
-The `expandBeforeAfterHooks`, `expandStepHooks`, `expandDocStrings`, `expandOutputs` and `expandSubSections` options can be set to `true` to expand or
-collapse before/after hooks, step hooks, docstrings, step outputs and sub sections respectively on scenario detail pages.
+The `expandBeforeAfterHooks`, `expandStepHooks`, `expandDocStrings`, `expandOutputs` and `expandSubSections` options can
+be set to `true` to expand or
+collapse before/after hooks, step hooks, docstrings, step outputs and sub sections respectively on scenario detail
+pages.
-If they are not set, they default to `false`. This means that the report user has to use the buttons on a scenario detail
+If they are not set, they default to `false`. This means that the report user has to use the buttons on a scenario
+detail
page to expand those sections on demand.
```xml
+
true|falsetrue|false
@@ -266,10 +282,12 @@ page to expand those sections on demand.
## Auto-expand Previous Runs
-The `expandPreviousScenarioRuns` option can be set to `true` to expand or collapse previous runs children element of the same scenario
+The `expandPreviousScenarioRuns` option can be set to `true` to expand or collapse previous runs children element of the
+same scenario
(on all scenarios page only, if `groupPreviousScenarioRuns` mode active).
```xml
+
true|false
...
@@ -282,6 +300,7 @@ By default, attachments are collapsed and can be toggled individually. If the `e
to `true`, they are automatically expanded.
```xml
+
true|false
...
@@ -295,6 +314,7 @@ to `true`, they are automatically expanded.
The default start page of the reports (if not overwritten by the `startPage` property) is the scenario overview page.
```xml
+
ALL_SCENARIOS
...
@@ -318,6 +338,7 @@ e.g. `Cluecumber Report - All Tags`.
By setting the property `customPageTitle`, this can be changed:
```xml
+
My Report
...
@@ -349,6 +370,7 @@ h3, h4, h5 {
To use this files, specify it like so in your pom file or as a system property:
```xml
+
custom/custom.css
...
@@ -368,12 +390,28 @@ Likewise, if you want to hide elements from the report, you can also add this to
}
```
+## Defining a custom favicon
+
+The favicon is displayed in the browser tab and can be customized by setting the `customFavicon` property. This must be
+a png file of size 16x16 or 32x32 pixels
+
+![Custom Favicon](../documentation/img/custom_favicon.png)
+
+```xml
+
+
+ custom/favicon.png
+ ...
+
+```
+
## Defining custom passed, skipped and failed colors
It is possible to set these properties to change the color scheme for passed, failed and skipped steps and scenarios
including the displayed diagrams. The values have to be valid hex colors:
```xml
+
#017FAF#C94A38
@@ -384,21 +422,22 @@ including the displayed diagrams. The values have to be valid hex colors:
The result of this customization is:
-| Before | After |
-|---|---|
+| Before | After |
+|--------------------------------------------------------|------------------------------------------------------|
| ![Chart Before](../documentation/img/chart_before.png) | ![Chart After](../documentation/img/chart_after.png) |
## Enabling a compact view of multiple runs of the same scenarios
It is possible to group multiple runs of the same scenario, especially useful for cases like reruns.
Enabling the feature will list the "children" elements (previous runs) on the "All scenarios" page
-as nested elements of the last run of that specific scenario.
+as nested elements of the last run of that specific scenario.
The grouping is based on scenario `id` + scenario `line`
-A button allows to expand/collapse, the default state can be set via `expandPreviousScenarioRuns`.
+A button allows to expand/collapse, the default state can be set via `expandPreviousScenarioRuns`.
```xml
+
- true
+ true
...
```
@@ -419,6 +458,7 @@ the `configuration` block must be outside of your `executions` block. Otherwise,
specified execution and is ignored when you run `mvn cluecumber-report:reporting` from the command line:
```xml
+
report
@@ -432,7 +472,7 @@ specified execution and is ignored when you run `mvn cluecumber-report:reporting
-
+
```
@@ -453,6 +493,7 @@ If you want to set a [custom parameter](#customparameters), you can do it like t
Set an empty property in your pom file's properties block:
```xml
+
@@ -461,6 +502,7 @@ Set an empty property in your pom file's properties block:
Also define it in the Cluecumber section in your POM:
```xml
+
${someProperty}
diff --git a/maven/pom.xml b/maven/pom.xml
index 436331ff..b1db4558 100644
--- a/maven/pom.xml
+++ b/maven/pom.xml
@@ -7,12 +7,12 @@
cluecumber-mavenmaven-plugin
- 3.6.3
+ 3.7.0cluecumber-parentcom.trivago.rta
- 3.6.3
+ 3.7.0Cluecumber Maven
diff --git a/maven/src/main/java/com/trivago/cluecumber/maven/CluecumberMaven.java b/maven/src/main/java/com/trivago/cluecumber/maven/CluecumberMaven.java
index b1fd8f0e..40279010 100644
--- a/maven/src/main/java/com/trivago/cluecumber/maven/CluecumberMaven.java
+++ b/maven/src/main/java/com/trivago/cluecumber/maven/CluecumberMaven.java
@@ -88,6 +88,12 @@ public final class CluecumberMaven extends AbstractMojo {
@Parameter(property = "reporting.customCss")
private String customCss = "";
+ /**
+ * Custom favicon that is used for the generated report.
+ */
+ @Parameter(property = "reporting.customFavicon")
+ private String customFavicon = "";
+
/**
* Custom flag that determines if step output sections of scenario detail pages should be expanded (default: false).
*/
@@ -189,6 +195,7 @@ public void execute() throws MojoExecutionException {
.setCustomStatusColorSkipped(customStatusColorSkipped)
.setLogLevel(CluecumberLogger.CluecumberLogLevel.valueOf(logLevel.toUpperCase()))
.setCustomCssFile(customCss)
+ .setCustomFaviconFile(customFavicon)
.setCustomNavigationLinks(customNavigationLinks)
.setCustomParameters(customParameters)
.setCustomParametersDisplayMode(Settings.CustomParamDisplayMode.valueOf(customParametersDisplayMode.toUpperCase()))
diff --git a/pom.xml b/pom.xml
index 1a289680..ed95330b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
com.trivago.rtacluecumber-parent
- 3.6.3
+ 3.7.0pomCluecumber Parent