diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2608d0aa..18ad401a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
Back to [Readme](README.md).
+## [2.6.1] - 2020-11-27
+
+### Fixed
+* After hooks with content were not displayed anymore
+
## [2.6.0] - 2020-11-27
### Fixed
@@ -603,6 +608,7 @@ steps with status `pending` or `undefined` (default value is `false`) (#74)
Initial project version on GitHub and Maven Central.
+[2.6.1]: https://github.com/trivago/cluecumber-report-plugin/tree/2.6.1
[2.6.0]: https://github.com/trivago/cluecumber-report-plugin/tree/2.6.0
[2.5.0]: https://github.com/trivago/cluecumber-report-plugin/tree/2.5.0
[2.4.0]: https://github.com/trivago/cluecumber-report-plugin/tree/2.4.0
diff --git a/example-project/pom.xml b/example-project/pom.xml
index 3f20f4cc..67ae5a98 100644
--- a/example-project/pom.xml
+++ b/example-project/pom.xml
@@ -6,7 +6,7 @@
de.benjamin-bischoff
cluecumber-test-project
- 2.6.0
+ 2.6.1
pom
@@ -69,8 +69,8 @@
true
-
-
+ true
+ true
diff --git a/plugin-code/pom.xml b/plugin-code/pom.xml
index bec000ac..4089d969 100644
--- a/plugin-code/pom.xml
+++ b/plugin-code/pom.xml
@@ -6,7 +6,7 @@
com.trivago.rta
cluecumber-report-plugin
- 2.6.0
+ 2.6.1
https://github.com/trivago/cluecumber-report-plugin
Cluecumber Maven Plugin for Cucumber Reports
diff --git a/plugin-code/src/main/java/com/trivago/cluecumber/json/pojo/Element.java b/plugin-code/src/main/java/com/trivago/cluecumber/json/pojo/Element.java
index ac213eb2..0248c4b7 100644
--- a/plugin-code/src/main/java/com/trivago/cluecumber/json/pojo/Element.java
+++ b/plugin-code/src/main/java/com/trivago/cluecumber/json/pojo/Element.java
@@ -149,7 +149,7 @@ public void setAfter(final List after) {
}
public boolean anyAfterHookHasContent() {
- for (ResultMatch resultMatch : before) {
+ for (ResultMatch resultMatch : after) {
if (resultMatch.hasContent()) {
return true;
}
@@ -319,6 +319,10 @@ public boolean hasHooks() {
return getBefore().size() > 0 || getAfter().size() > 0;
}
+ public boolean hasHooksWithContent() {
+ return anyBeforeHookHasContent() || anyAfterHookHasContent();
+ }
+
public boolean hasDocStrings() {
for (Step step : backgroundSteps) {
if (step.getDocString() != null) {
@@ -353,6 +357,22 @@ public boolean hasStepHooks() {
return false;
}
+ public boolean hasStepHooksWithContent() {
+ for (Step step : backgroundSteps) {
+ if (step.hasHooksWithContent())
+ {
+ return true;
+ }
+ }
+ for (Step step : steps) {
+ if (step.hasHooksWithContent())
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
public List getAllResultMatches() {
List resultMatches = new ArrayList<>(getBefore());
resultMatches.addAll(getBackgroundSteps());
diff --git a/plugin-code/src/main/java/com/trivago/cluecumber/json/pojo/Step.java b/plugin-code/src/main/java/com/trivago/cluecumber/json/pojo/Step.java
index 05b27533..2c70d487 100644
--- a/plugin-code/src/main/java/com/trivago/cluecumber/json/pojo/Step.java
+++ b/plugin-code/src/main/java/com/trivago/cluecumber/json/pojo/Step.java
@@ -35,6 +35,20 @@ public class Step extends ResultMatch {
@SerializedName("doc_string")
private DocString docString;
+ public boolean hasHooksWithContent() {
+ for (ResultMatch resultMatch : before) {
+ if (resultMatch.hasContent()) {
+ return true;
+ }
+ }
+ for (ResultMatch resultMatch : after) {
+ if (resultMatch.hasContent()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
public List getBefore() {
return before;
}
@@ -65,7 +79,10 @@ public String returnNameWithArguments() {
for (int i = arguments.size() - 1; i >= 0; i--) {
String argument = arguments.get(i).getVal();
if (argument != null) {
- tmpName = tmpName.replaceFirst(Pattern.quote(argument), Matcher.quoteReplacement("" + argument + ""));
+ tmpName = tmpName.replaceFirst(
+ Pattern.quote(argument),
+ Matcher.quoteReplacement("" + argument + "")
+ );
}
}
return tmpName;
@@ -116,7 +133,8 @@ public void setDocString(final DocString docString) {
}
public long getTotalDuration() {
- long totalDurationNanoseconds = before.stream().mapToLong(beforeStep -> beforeStep.getResult().getDuration()).sum();
+ long totalDurationNanoseconds =
+ before.stream().mapToLong(beforeStep -> beforeStep.getResult().getDuration()).sum();
totalDurationNanoseconds += getResult().getDuration();
totalDurationNanoseconds += after.stream().mapToLong(afterStep -> afterStep.getResult().getDuration()).sum();
return totalDurationNanoseconds;
@@ -132,8 +150,12 @@ public String getUrlFriendlyName() {
@Override
public boolean equals(final Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
Step step = (Step) o;
return Objects.equals(getGlueMethodName(), step.getGlueMethodName());
}
diff --git a/plugin-code/src/main/resources/template/scenario-detail.ftl b/plugin-code/src/main/resources/template/scenario-detail.ftl
index 87572b79..d55d034e 100644
--- a/plugin-code/src/main/resources/template/scenario-detail.ftl
+++ b/plugin-code/src/main/resources/template/scenario-detail.ftl
@@ -59,13 +59,13 @@ preheadlineLink="pages/feature-scenarios/feature_${element.featureIndex?c}.html"
${element.totalNumberOfSkippedSteps} skipped <@common.status status="skipped"/>
- <#if element.hasHooks() && (element.anyBeforeHookHasContent() || element.anyAfterHookHasContent())>
+ <#if element.hasHooks() && element.hasHooksWithContent()>
#if>
- <#if element.hasStepHooks()>
+ <#if element.hasStepHooks() && element.hasStepHooksWithContent()>