Skip to content

Commit

Permalink
Renaming properties
Browse files Browse the repository at this point in the history
  • Loading branch information
gdonati78 committed Nov 2, 2023
1 parent 4250451 commit c2646d2
Show file tree
Hide file tree
Showing 17 changed files with 111 additions and 111 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ Back to [Readme](README.md).
## [3.5.0] - 2023-11-02

### Added
* `showOnlyLastRuns` mode for a compact view when there are multiple runs of the same scenario [#245]
* `expandPreviousRuns` to set default state of expanded or collapsed of the previous runs of the same scenario
* `groupPreviousScenarioRuns` mode for a compact view when there are multiple runs of the same scenario [#245]
* `expandPreviousScenarioRuns` to set default state of expanded or collapsed of the previous runs of the same scenario

## [3.4.0] - 2023-08-10

Expand Down
16 changes: 8 additions & 8 deletions core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,15 +241,15 @@ new CluecumberCore.Builder()
.build().generateReports(jsonDirectory, reportDirectory);
```

## Auto-expand Previous Runs
## Auto-expand Previous Scenario Runs

The `expandPreviousRuns` option can be set to `true` to expand or collapse previous runs children element of the same scenario
(on all scenarios page only, if `showOnlyLastRuns` mode active).
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).

```java
new CluecumberCore.Builder()
.setShowOnlyLastRuns(true)
.setExpandPreviousRuns(true)
.setGroupPreviousScenarioRuns(true)
.setExpandPreviousScenarioRuns(true)
.build().generateReports(jsonDirectory, reportDirectory);
```

Expand Down Expand Up @@ -366,12 +366,12 @@ It is possible to group multiple runs of the same scenario, especially useful fo
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.
The grouping is based on scenario `id` + scenario `line`
A button allows to expand/collapse, the default state can be set via `expandPreviousRuns`.
A button allows to expand/collapse, the default state can be set via `expandPreviousScenarioRuns`.

```java
new CluecumberCore.Builder()
.setShowOnlyLastRuns(true)
.setExpandPreviousRuns(false)
.setGroupPreviousScenarioRuns(true)
.setExpandPreviousScenarioRuns(false)
.build().generateReports(jsonDirectory, reportDirectory);
```

Expand Down
22 changes: 11 additions & 11 deletions core/src/main/java/com/trivago/cluecumber/core/CluecumberCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ private CluecumberCore(Builder builder) throws CluecumberException {
cluecumberEngine.setExpandBeforeAfterHooks(builder.expandBeforeAfterHooks);
cluecumberEngine.setExpandDocStrings(builder.expandDocStrings);
cluecumberEngine.setExpandStepHooks(builder.expandStepHooks);
cluecumberEngine.setShowOnlyLastRuns(builder.showOnlyLastRuns);
cluecumberEngine.setExpandPreviousRuns(builder.expandPreviousRuns);
cluecumberEngine.setGroupPreviousScenarioRuns(builder.groupPreviousScenarioRuns);
cluecumberEngine.setExpandPreviousScenarioRuns(builder.expandPreviousScenarioRuns);
cluecumberEngine.setFailScenariosOnPendingOrUndefinedSteps(builder.failScenariosOnPendingOrUndefinedSteps);
cluecumberEngine.setLogLevel(builder.logLevel);
cluecumberEngine.setStartPage(builder.startPage);
Expand Down Expand Up @@ -80,8 +80,8 @@ public static class Builder {
private boolean expandBeforeAfterHooks;
private boolean expandDocStrings;
private boolean expandStepHooks;
private boolean showOnlyLastRuns;
private boolean expandPreviousRuns;
private boolean groupPreviousScenarioRuns;
private boolean expandPreviousScenarioRuns;
private String logLevel;
private String startPage;
private boolean failScenariosOnPendingOrUndefinedSteps;
Expand Down Expand Up @@ -231,24 +231,24 @@ public Builder setExpandStepHooks(final boolean expandStepHooks) {
}

/**
* Whether to show the toggle to show elements that are not last run.
* Whether to show the scenarios run multiple times should be grouped and the show not last run toggle should be shown.
*
* @param showOnlyLastRuns If true, the toggle to show elements that are not last run will be shown.
* @param groupPreviousScenarioRuns If true, the scenarios run multiple times should be grouped and the show not last run toggle should be shown.
* @return The {@link Builder}.
*/
public Builder setShowOnlyLastRuns(final boolean showOnlyLastRuns) {
this.showOnlyLastRuns = showOnlyLastRuns;
public Builder setGroupPreviousScenarioRuns(final boolean groupPreviousScenarioRuns) {
this.groupPreviousScenarioRuns = groupPreviousScenarioRuns;
return this;
}

/**
* Whether to expand elements that are not last run.
*
* @param expandPreviousRuns If true, elements that are not last run will be expanded.
* @param expandPreviousScenarioRuns If true, elements that are not last run will be expanded.
* @return The {@link Builder}.
*/
public Builder setExpandPreviousRuns(final boolean expandPreviousRuns) {
this.expandPreviousRuns = expandPreviousRuns;
public Builder setExpandPreviousScenarioRuns(final boolean expandPreviousScenarioRuns) {
this.expandPreviousScenarioRuns = expandPreviousScenarioRuns;
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public void build(
}
}
elementIndexPreProcessor.addScenarioIndices(allScenariosPageCollection.getReports());
if (propertyManager.isShowOnlyLastRuns()) {
if (propertyManager.isGroupPreviousScenarioRuns()) {
elementMultipleRunsPreProcessor.addMultipleRunsInformationToScenarios(allScenariosPageCollection.getReports());
}
reportGenerator.generateReport(allScenariosPageCollection);
Expand Down Expand Up @@ -236,21 +236,21 @@ public void setExpandAttachments(final boolean expandAttachments) {
}

/**
* Whether to show the toggle to show not last run elements.
* Whether to show the scenarios run multiple times should be grouped and the show not last run toggle should be shown.
*
* @param showOnlyLastRuns If true, the toggle to show not last run elements will be shown.
* @param groupPreviousScenarioRuns If true, the scenarios run multiple times should be grouped and the show not last run toggle should be shown.
*/
public void setShowOnlyLastRuns(final boolean showOnlyLastRuns) {
propertyManager.setShowOnlyLastRuns(showOnlyLastRuns);
public void setGroupPreviousScenarioRuns(final boolean groupPreviousScenarioRuns) {
propertyManager.setGroupPreviousScenarioRuns(groupPreviousScenarioRuns);
}

/**
* Whether to expand not last run elements or not.
*
* @param expandPreviousRuns If true, not last run elements will be expanded.
* @param expandPreviousScenarioRuns If true, not last run elements will be expanded.
*/
public void setExpandPreviousRuns(final boolean expandPreviousRuns) {
propertyManager.setExpandPreviousRuns(expandPreviousRuns);
public void setExpandPreviousScenarioRuns(final boolean expandPreviousScenarioRuns) {
propertyManager.setExpandPreviousScenarioRuns(expandPreviousScenarioRuns);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ public class PropertyManager {
private boolean expandStepHooks = false;
private boolean expandDocStrings = false;
private boolean expandAttachments = true;
private boolean showOnlyLastRuns = false;
private boolean expandPreviousRuns = true;
private boolean groupPreviousScenarioRuns = false;
private boolean expandPreviousScenarioRuns = true;
private String customCssFile;
private String customParametersFile;
private Settings.CustomParamDisplayMode customParametersDisplayMode =
Expand Down Expand Up @@ -324,39 +324,39 @@ public void setExpandAttachments(final boolean expandAttachments) {
}

/**
* This determines whether the not last run toggle and related indications should be shown.
* This determines whether the scenarios run multiple times should be grouped and the show not last run toggle should be shown.
*
* @return true means it should be shown.
* @return true means scenarios should be grouped and toggle should be shown.
*/
public boolean isShowOnlyLastRuns() {
return showOnlyLastRuns;
public boolean isGroupPreviousScenarioRuns() {
return groupPreviousScenarioRuns;
}

/**
* Set whether the not last run toggle and related indications should be show.
* Set whether the scenarios run multiple times should be grouped and the show not last run toggle should be shown.
*
* @param showOnlyLastRuns true means it should be shown.
* @param groupPreviousScenarioRuns true means scenarios should be grouped and toggle should be shown.
*/
public void setShowOnlyLastRuns(final boolean showOnlyLastRuns) {
this.showOnlyLastRuns = showOnlyLastRuns;
public void setGroupPreviousScenarioRuns(final boolean groupPreviousScenarioRuns) {
this.groupPreviousScenarioRuns = groupPreviousScenarioRuns;
}

/**
* This determines whether the not last run elements should be expanded and shown.
*
* @return true means it should be shown.
* @return true means it should be expanded.
*/
public boolean isExpandPreviousRuns() {
return expandPreviousRuns;
public boolean isExpandPreviousScenarioRuns() {
return expandPreviousScenarioRuns;
}

/**
* Set whether the not last run elements should be expanded and shown.
*
* @param expandPreviousRuns true means elements should be expanded.
* @param expandPreviousScenarioRuns true means elements should be expanded.
*/
public void setExpandPreviousRuns(final boolean expandPreviousRuns) {
this.expandPreviousRuns = expandPreviousRuns;
public void setExpandPreviousScenarioRuns(final boolean expandPreviousScenarioRuns) {
this.expandPreviousScenarioRuns = expandPreviousScenarioRuns;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
*/
public class AllScenariosPageCollection extends PageCollection implements Visitable {
private List<Report> reports = new ArrayList<>();
private boolean showOnlyLastRuns;
private boolean expandPreviousRuns;
private boolean groupPreviousScenarioRuns;
private boolean expandPreviousScenarioRuns;
private Tag tagFilter;
private Feature featureFilter;
private Step stepFilter;
Expand Down Expand Up @@ -371,39 +371,39 @@ public void setStepFilter(final Step stepFilter) {
}

/**
* This determines whether the not last run toggle and related indications should be shown.
* This determines whether the scenarios run multiple times should be grouped and the show not last run toggle should be shown.
*
* @return true means it should be shown.
* @return true means scenarios should be grouped and toggle should be shown.
*/
public boolean isShowOnlyLastRuns() {
return showOnlyLastRuns;
public boolean isGroupPreviousScenarioRuns() {
return groupPreviousScenarioRuns;
}

/**
* Set whether the not last run toggle and related indications should be show.
* Set whether the scenarios run multiple times should be grouped and the show not last run toggle should be shown.
*
* @param showOnlyLastRuns true means it should be shown.
* @param groupPreviousScenarioRuns true means scenarios should be grouped and toggle should be shown.
*/
public void setShowOnlyLastRuns(final boolean showOnlyLastRuns) {
this.showOnlyLastRuns = showOnlyLastRuns;
public void setGroupPreviousScenarioRuns(final boolean groupPreviousScenarioRuns) {
this.groupPreviousScenarioRuns = groupPreviousScenarioRuns;
}

/**
* This determines whether the not last run elements should be expanded and shown.
*
* @return true means it should be shown.
* @return true means it should be expanded.
*/
public boolean isExpandPreviousRuns() {
return expandPreviousRuns;
public boolean isExpandPreviousScenarioRuns() {
return expandPreviousScenarioRuns;
}

/**
* Set whether the not last run elements should be expanded and shown.
*
* @param expandPreviousRuns true means elements should be expanded.
* @param expandPreviousScenarioRuns true means elements should be expanded.
*/
public void setExpandPreviousRuns(final boolean expandPreviousRuns) {
this.expandPreviousRuns = expandPreviousRuns;
public void setExpandPreviousScenarioRuns(final boolean expandPreviousScenarioRuns) {
this.expandPreviousScenarioRuns = expandPreviousScenarioRuns;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public class PageCollection implements Cloneable {
private boolean expandStepHooks;
private boolean expandDocStrings;
private boolean expandAttachments;
private boolean showOnlyLastRuns;
private boolean expandPreviousRuns;
private boolean groupPreviousScenarioRuns;
private boolean expandPreviousScenarioRuns;
private List<CustomParameter> customParameters;
private CustomParamDisplayMode displayMode;
private List<Link> links;
Expand Down Expand Up @@ -129,39 +129,39 @@ public void setExpandAttachments(final boolean expandAttachments) {
}

/**
* This determines whether the not last run toggle and related indications should be shown.
* This determines whether the scenarios run multiple times should be grouped and the show not last run toggle should be shown.
*
* @return true means it should be shown.
* @return true means scenarios should be grouped and toggle should be shown.
*/
public boolean isShowOnlyLastRuns() {
return showOnlyLastRuns;
public boolean isGroupPreviousScenarioRuns() {
return groupPreviousScenarioRuns;
}

/**
* Set whether the not last run toggle and related indications should be show.
* Set whether the scenarios run multiple times should be grouped and the show not last run toggle should be shown.
*
* @param showOnlyLastRuns true means it should be shown.
* @param groupPreviousScenarioRuns true means scenarios should be grouped and toggle should be shown.
*/
public void setShowOnlyLastRuns(final boolean showOnlyLastRuns) {
this.showOnlyLastRuns = showOnlyLastRuns;
public void setGroupPreviousScenarioRuns(final boolean groupPreviousScenarioRuns) {
this.groupPreviousScenarioRuns = groupPreviousScenarioRuns;
}

/**
* This determines whether the not last run elements should be expanded and shown.
*
* @return true means it should be shown.
* @return true means it should be expanded.
*/
public boolean isExpandPreviousRuns() {
return expandPreviousRuns;
public boolean isExpandPreviousScenarioRuns() {
return expandPreviousScenarioRuns;
}

/**
* Set whether the not last run elements should be expanded and shown.
*
* @param expandPreviousRuns true means elements should be expanded.
* @param expandPreviousScenarioRuns true means elements should be expanded.
*/
public void setExpandPreviousRuns(final boolean expandPreviousRuns) {
this.expandPreviousRuns = expandPreviousRuns;
public void setExpandPreviousScenarioRuns(final boolean expandPreviousScenarioRuns) {
this.expandPreviousScenarioRuns = expandPreviousScenarioRuns;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ public String getRenderedContent(

AllScenariosPageCollection allScenariosPageCollectionClone = getAllScenariosPageCollectionClone(allScenariosPageCollection);

allScenariosPageCollectionClone.setShowOnlyLastRuns(propertyManager.isShowOnlyLastRuns());
allScenariosPageCollectionClone.setExpandPreviousRuns(propertyManager.isExpandPreviousRuns());
allScenariosPageCollectionClone.setGroupPreviousScenarioRuns(propertyManager.isGroupPreviousScenarioRuns());
allScenariosPageCollectionClone.setExpandPreviousScenarioRuns(propertyManager.isExpandPreviousScenarioRuns());
addChartJsonToReportDetails(allScenariosPageCollectionClone);
return processedContent(template, allScenariosPageCollectionClone, propertyManager.getNavigationLinks());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ public String getRenderedContent(
scenarioDetailsPageCollection.setExpandStepHooks(propertyManager.isExpandStepHooks());
scenarioDetailsPageCollection.setExpandDocStrings(propertyManager.isExpandDocStrings());
scenarioDetailsPageCollection.setExpandAttachments(propertyManager.isExpandAttachments());
scenarioDetailsPageCollection.setExpandPreviousRuns(propertyManager.isExpandPreviousRuns());
scenarioDetailsPageCollection.setShowOnlyLastRuns(propertyManager.isShowOnlyLastRuns());
scenarioDetailsPageCollection.setExpandPreviousScenarioRuns(propertyManager.isExpandPreviousScenarioRuns());
scenarioDetailsPageCollection.setGroupPreviousScenarioRuns(propertyManager.isGroupPreviousScenarioRuns());

addChartJsonToReportDetails(scenarioDetailsPageCollection);

Expand Down
6 changes: 3 additions & 3 deletions engine/src/main/resources/template/macros/scenario.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ limitations under the License.
<#assign passedRequested = status == "passed">
<#assign allRequested = status == "all">

<#if isShowOnlyLastRuns()>
<#if isGroupPreviousScenarioRuns()>
<#assign failuresCondition = (failedRequested && hasFailedScenariosNotPassedOnLastRun())>
<#else>
<#assign failuresCondition = (failedRequested && hasFailedScenarios())>
Expand Down Expand Up @@ -95,7 +95,7 @@ limitations under the License.
<#if (skippedRequested && element.skipped) || (failedRequested && element.failed) || (passedRequested && element.passed) || allRequested>
<#assign isLastOfMultipleScenarioRuns = element.getIsLastOfMultipleScenarioRuns()>
<#assign isNotLastOfMultipleScenarioRuns = element.getIsNotLastOfMultipleScenarioRuns()>
<#if !isShowOnlyLastRuns() || (isShowOnlyLastRuns() && !isNotLastOfMultipleScenarioRuns) || allRequested>
<#if !isGroupPreviousScenarioRuns() || (isGroupPreviousScenarioRuns() && !isNotLastOfMultipleScenarioRuns) || allRequested>
<tr class="table-row-${element.status.statusString}">
<#if allRequested>
<td class="text-right">${element.scenarioIndex}</td>
Expand All @@ -110,7 +110,7 @@ limitations under the License.
<#if element.firstExceptionClass != "">
<p class="firstException text-left small text-gray" style="word-break: break-word">${element.firstExceptionClass}</p>
</#if>
<#if isShowOnlyLastRuns() && isLastOfMultipleScenarioRuns && !allRequested>
<#if isGroupPreviousScenarioRuns() && isLastOfMultipleScenarioRuns && !allRequested>
<#list element.getChildrenElements() as childElement>
<div class="notLastRun collapse">
/-- <a href="pages/scenario-detail/scenario_${childElement.scenarioIndex?c}.html" style="word-break: break-all">Previous run - started at: ${childElement.startDateString} - ${childElement.startTimeString} <@common.status status=childElement.status.statusString/></a>
Expand Down
Loading

0 comments on commit c2646d2

Please sign in to comment.