-
+
<#if headline != ""> -

${headline}

+ Logo +
+

+ ${headline} +

<#if preheadline != ""> - + <#if preheadlineLink != ""> ${preheadline} @@ -66,7 +70,7 @@ limitations under the License. <#if subheadline != ""> -

${subheadline}

+

${subheadline}

<#nested> diff --git a/engine/src/main/resources/template/macros/scenario.ftl b/engine/src/main/resources/template/macros/scenario.ftl index 64659d31..0a6e9e00 100644 --- a/engine/src/main/resources/template/macros/scenario.ftl +++ b/engine/src/main/resources/template/macros/scenario.ftl @@ -110,9 +110,9 @@ limitations under the License. - <#if element.firstExceptionClass != ""> + <#if element.firstExceptionSummary != "">

${element.firstExceptionClass}

+ style="word-break: break-word">${element.firstExceptionSummary}

<#if element.isMultiRunParent()> @@ -123,12 +123,13 @@ limitations under the License.
  • Previous run from - ${childElement.startDateString}, ${childElement.startTimeString} + ${childElement.startDateString} + , ${childElement.startTimeString} <@common.status status=childElement.status.statusString/> - <#if childElement.firstExceptionClass != ""> + <#if childElement.firstExceptionSummary != "">

    ${childElement.firstExceptionClass}

    + style="word-break: break-word">${childElement.firstExceptionSummary}

  • @@ -163,6 +164,7 @@ limitations under the License. <#list step.embeddings as attachment>
    <#assign attachmentID = attachment.hashCode()?string["0"]> + <#assign isTextAttachment = attachment.mimeType == "TXT" || attachment.mimeType == "XML" || attachment.mimeType == "JSON" || attachment.mimeType == "APPLICATION_XML">
    | @@ -171,6 +173,11 @@ limitations under the License. <#else> ${attachment.mimeType} attachment + <#if isTextAttachment> + +
    - <#elseif attachment.mimeType == "TXT" || attachment.mimeType == "XML" || attachment.mimeType == "JSON" || attachment.mimeType == "APPLICATION_XML"> + <#elseif isTextAttachment>
    ${attachment.decodedData}
    <#elseif attachment.mimeType == "MP4"> <#if attachment.externalContent> @@ -209,7 +216,10 @@ limitations under the License. <#macro errorMessage step> <#if step.result.hasErrorMessage()>
    -
    + +
    ${step.result.returnErrorMessageWithClickableLinks()}
    @@ -228,6 +238,9 @@ limitations under the License.
    +
    ${step.output?join("
    ")}
    diff --git a/engine/src/main/resources/template/scenario-detail.ftl b/engine/src/main/resources/template/scenario-detail.ftl index d1861e45..93643d15 100644 --- a/engine/src/main/resources/template/scenario-detail.ftl +++ b/engine/src/main/resources/template/scenario-detail.ftl @@ -242,6 +242,9 @@ preheadlineLink="pages/feature-scenarios/feature_${element.featureIndex?c}.html" <#if (step.docString.value)?? >
    +
    ${step.docString.returnWithClickableLinks()}
    @@ -340,6 +343,9 @@ preheadlineLink="pages/feature-scenarios/feature_${element.featureIndex?c}.html" <#if (step.docString.value)?? >
    +
    ${step.docString.returnWithClickableLinks()}
    diff --git a/engine/src/main/resources/template/scenario-summary.ftl b/engine/src/main/resources/template/scenario-summary.ftl index 59cf4456..6d9eec52 100644 --- a/engine/src/main/resources/template/scenario-summary.ftl +++ b/engine/src/main/resources/template/scenario-summary.ftl @@ -22,10 +22,19 @@ limitations under the License. <#if (tagFilter??)> <#assign base = "./../.."> - <#assign headline = "Scenarios tagged with '${tagFilter.name}'"> + <#assign headline = "Scenarios tagged with"> <#assign pageName = "Tagged Scenarios"> <#assign highlight = "tag_summary"> - <#assign subheadline = ""> + <#assign subheadline = "${tagFilter.name}"> + <#assign subsubheadline = ""> + <#assign preheadline = ""> + <#assign preheadlineLink = ""> +<#elseif (exceptionFilter??)> + <#assign base = "./../.."> + <#assign headline = "Scenarios with Exception"> + <#assign pageName = "Scenarios with Exception"> + <#assign highlight = "exception_summary"> + <#assign subheadline = "${exceptionFilter}"> <#assign subsubheadline = ""> <#assign preheadline = ""> <#assign preheadlineLink = ""> @@ -40,10 +49,10 @@ limitations under the License. <#assign preheadlineLink="pages/feature-scenarios/feature_${featureFilter.index?c}.html"> <#elseif (stepFilter??)> <#assign base = "./../.."> - <#assign headline = "Scenarios using Step '${stepFilter.returnNameWithArgumentPlaceholders()}'"> + <#assign headline = "Scenarios using Step"> <#assign pageName = "Scenarios with Step"> <#assign highlight = "step_summary"> - <#assign subheadline = ""> + <#assign subheadline = "${stepFilter.returnNameWithArgumentPlaceholders()}"> <#assign subsubheadline = ""> <#assign preheadline = ""> <#assign preheadlineLink = ""> diff --git a/engine/src/main/resources/template/snippets/js.ftl b/engine/src/main/resources/template/snippets/js.ftl index 35ca10e6..ff4998e2 100644 --- a/engine/src/main/resources/template/snippets/js.ftl +++ b/engine/src/main/resources/template/snippets/js.ftl @@ -150,4 +150,15 @@ limitations under the License. } }, 500); } + + function copyText(elementId) { + let text = document.getElementById(elementId).innerText; + if (text.startsWith("Copy to clipboard")) { + text = text.substring(18); + } + navigator.clipboard.writeText(text) + .catch((error) => { + console.error('Failed to copy text from ' + elementId + ':', error); + }); + } \ No newline at end of file diff --git a/engine/src/main/resources/template/tree-view.ftl b/engine/src/main/resources/template/tree-view.ftl index 0e78e4b8..db7b29a0 100644 --- a/engine/src/main/resources/template/tree-view.ftl +++ b/engine/src/main/resources/template/tree-view.ftl @@ -30,31 +30,48 @@ preheadlineLink="">
    <@page.card width="12" title="${numberOfFeatures} ${common.pluralizeFn('Feature', numberOfFeatures)} with ${numberOfScenarios} ${common.pluralizeFn('Scenario', numberOfScenarios)}" subtitle="" classes=""> -
      - <#list elements as feature, scenarios> - <#assign tooltipText = ""> - <#if feature.description?has_content> - <#assign tooltipText = "${feature.description} | "> - - <#assign tooltipText = "${tooltipText}${feature.uri}"> -
    • - - ${feature.name?html} - -
    • -
        - <#list scenarios as scenario> - <#if ((!scenario.isMultiRunParent() && !scenario.isMultiRunChild()) || scenario.isMultiRunParent()) > -
      1. ${scenario.name?html} -
      2. - + <#macro renderTree node> + <#if node.children?has_content> +
          + <#list node.children?values as child> +
        1. + <#if child.features??> + <#list child.features as feature, scenarios> + <#assign tooltipText = "${feature.uri}"> + <#if feature.description?has_content> + <#assign tooltipText = "${tooltipText} | ${feature.description}"> + + + + ${feature.name?html} + + + <#if scenarios??> +
            + <#list scenarios as scenario> + <#if ((!scenario.isMultiRunParent() && !scenario.isMultiRunChild()) || scenario.isMultiRunParent()) > +
          • + ${scenario.name?html} +
          • + + +
          + +
          + + <#else> + ${child.name}/ + + <@renderTree node=child/> +
        -
        - -
    + + +
    + <@renderTree node=rootTreeNode/> +
    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 d51419dd..6f932a07 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(9)).createDirectory(anyString()); - verify(fileSystemManager, times(18)).copyResourceFromJar(anyString(), anyString()); + verify(fileSystemManager, times(10)).createDirectory(anyString()); + verify(fileSystemManager, times(19)).copyResourceFromJar(anyString(), anyString()); } } diff --git a/engine/src/test/java/com/trivago/cluecumber/engine/rendering/pages/pojos/pagecollections/PojoTest.java b/engine/src/test/java/com/trivago/cluecumber/engine/rendering/pages/pojos/pagecollections/PojoTest.java index b57c00b0..0d28b7ab 100644 --- a/engine/src/test/java/com/trivago/cluecumber/engine/rendering/pages/pojos/pagecollections/PojoTest.java +++ b/engine/src/test/java/com/trivago/cluecumber/engine/rendering/pages/pojos/pagecollections/PojoTest.java @@ -15,7 +15,7 @@ import java.util.List; public class PojoTest { - private static final int EXPECTED_CLASS_COUNT = 12; + private static final int EXPECTED_CLASS_COUNT = 13; private static final String POJO_PACKAGE = "com.trivago.cluecumber.engine.rendering.pages.pojos.pagecollections"; @BeforeAll diff --git a/engine/src/test/java/com/trivago/cluecumber/engine/rendering/pages/visitors/VisitorDirectoryTest.java b/engine/src/test/java/com/trivago/cluecumber/engine/rendering/pages/visitors/VisitorDirectoryTest.java index 624de2e7..da99d210 100644 --- a/engine/src/test/java/com/trivago/cluecumber/engine/rendering/pages/visitors/VisitorDirectoryTest.java +++ b/engine/src/test/java/com/trivago/cluecumber/engine/rendering/pages/visitors/VisitorDirectoryTest.java @@ -14,17 +14,19 @@ public void setUp() { ScenarioVisitor scenarioVisitor = mock(ScenarioVisitor.class); FeatureVisitor featureVisitor = mock(FeatureVisitor.class); TagVisitor tagVisitor = mock(TagVisitor.class); + ExceptionVisitor exceptionVisitor = mock(ExceptionVisitor.class); StepVisitor stepVisitor = mock(StepVisitor.class); visitorDirectory = new VisitorDirectory( scenarioVisitor, featureVisitor, tagVisitor, + exceptionVisitor, stepVisitor ); } @Test public void getVisitorDirectoryTest() { - assertEquals(visitorDirectory.getVisitors().size(), 4); + assertEquals(visitorDirectory.getVisitors().size(), 5); } } diff --git a/examples/core-example/pom.xml b/examples/core-example/pom.xml index 210eb1df..00cf9b9d 100644 --- a/examples/core-example/pom.xml +++ b/examples/core-example/pom.xml @@ -6,7 +6,7 @@ blog.softwaretester core-example - 3.10.0 + 3.11.0 jar diff --git a/examples/maven-example/README.md b/examples/maven-example/README.md index 208d6c48..5abe7f19 100644 --- a/examples/maven-example/README.md +++ b/examples/maven-example/README.md @@ -4,8 +4,8 @@ - [Cluecumber Maven Example](#cluecumber-maven-example) - - [Configuration options](#configuration-options) - - [Run the project](#run-the-project) + - [Configuration options](#configuration-options) + - [Run the project](#run-the-project) @@ -24,8 +24,10 @@ You can add different options as explained in the [Cluecumber Maven Readme](../. To run the project you need to have at least Java 11 and Maven 3.3.9 installed on your system. -Just run the Maven command ```mvn clean verify``` to see the report generation of Cluecumber in action. +Just run the Maven command `mvn clean verify` to see the report generation of Cluecumber in action. +This can also be run via `make test` from Cluecumber's root directory. -The example Cucumber JSON files are located in the project's `json` directory. These are based on the https://github.com/aslakhellesoy/cucumber-json-formatter project. +The example Cucumber JSON files are located in the project's `json` directory. These are based on +the https://github.com/aslakhellesoy/cucumber-json-formatter project. The report is generated inside the `target/cluecumber-report` directory. diff --git a/examples/maven-example/custom/logo.png b/examples/maven-example/custom/logo.png new file mode 100644 index 00000000..30003fda Binary files /dev/null and b/examples/maven-example/custom/logo.png differ diff --git a/examples/maven-example/pom.xml b/examples/maven-example/pom.xml index c9f19523..7eb77650 100644 --- a/examples/maven-example/pom.xml +++ b/examples/maven-example/pom.xml @@ -6,7 +6,7 @@ blog.softwaretester maven-example - 3.10.0 + 3.11.0 pom @@ -72,10 +72,13 @@ - + - + ${project.basedir}/custom/favicon.png + + + ${project.basedir}/custom/logo.png false diff --git a/maven/README.md b/maven/README.md index f855d8c8..c1cd9c7f 100644 --- a/maven/README.md +++ b/maven/README.md @@ -33,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 logo](#defining-a-custom-logo) - [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) @@ -52,7 +53,7 @@ _Clear and concise Maven reporting for the Cucumber BDD JSON format_ com.trivago.rta cluecumber-maven - 3.1.0 + 3.11.0 report @@ -390,6 +391,20 @@ Likewise, if you want to hide elements from the report, you can also add this to } ``` +## Defining a custom logo + +The logo is displayed on every page in the top right corner and can be customized by setting the `customLogo` property. This must be +a png file. It is automatically set to a maximum width of 300px and/or height of 100px if its size exceeds these values. + +![Custom Logo](../documentation/img/custom_logo.jpg) + +```xml + + custom/logo.png + ... + +``` + ## Defining a custom favicon The favicon is displayed in the browser tab and can be customized by setting the `customFavicon` property. This must be @@ -398,7 +413,6 @@ a png file of size 16x16 or 32x32 pixels ![Custom Favicon](../documentation/img/custom_favicon.png) ```xml - custom/favicon.png ... 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 ade0e57f..ccf36faa 100644 --- a/maven/src/main/java/com/trivago/cluecumber/maven/CluecumberMaven.java +++ b/maven/src/main/java/com/trivago/cluecumber/maven/CluecumberMaven.java @@ -95,6 +95,12 @@ public final class CluecumberMaven extends AbstractMojo { @Parameter(property = "reporting.customFavicon") private String customFavicon = ""; + /** + * Custom logo that is used for the generated report. + */ + @Parameter(property = "reporting.customLogo") + private String customLogo = ""; + /** * Custom flag that determines if step output sections of scenario detail pages should be expanded (default: false). */ @@ -197,6 +203,7 @@ public void execute() throws MojoExecutionException { .setLogLevel(CluecumberLogger.CluecumberLogLevel.valueOf(logLevel.toUpperCase())) .setCustomCssFile(customCss) .setCustomFaviconFile(customFavicon) + .setCustomLogoFile(customLogo) .setCustomNavigationLinks(customNavigationLinks) .setCustomParameters(customParameters) .setCustomParametersDisplayMode(Settings.CustomParamDisplayMode.valueOf(customParametersDisplayMode.toUpperCase())) diff --git a/pom.xml b/pom.xml index 60cd6a0d..b3f7bbdd 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,7 @@ - 3.10.0 + 3.11.0 11 11 11 @@ -33,11 +33,11 @@ 3.11.0 3.2.7 1.7.0 - 5.11.4 + 5.12.0-RC2 5.15.2 3.5.2 3.3.1 - 3.11.1 + 3.11.2 3.1.1 3.3.1 3.1.3