Skip to content

Commit

Permalink
bugfix: even when all the tests are passing, the link to “unsuccessfu…
Browse files Browse the repository at this point in the history
…l” test results remains active, but leads to a non-existent page
  • Loading branch information
cliviu committed Mar 5, 2019
1 parent da7135d commit 6f66ac3
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ public Integer getOverallTestCount(String result) {
return totalTests.getOrDefault(TestResult.valueOf(result.toUpperCase()),0);
}

public Integer getOverallTestsCount(String... results) {
int allTestsCount = 0;
for(String result : results) {
allTestsCount += getOverallTestCount(result);
}
return allTestsCount;
}

public Integer getTotalAutomatedTestCount() {
return totalAutomatedTests;
}
Expand Down
28 changes: 20 additions & 8 deletions serenity-report-resources/src/main/resources/freemarker/home.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -366,15 +366,27 @@
</tr>
<tr>
<#if resultCounts.hasManualTests() >
<td colspan="7"><a
href="${relativeLink}${brokenReport}"><i
class='fa fa-times failure-icon'></i>&nbsp;<em>Unsuccessful</em></a>
</td>
<#if (resultCounts.getOverallTestsCount("failure","error","compromised") != 0)>
<td colspan="7"><a
href="${relativeLink}${brokenReport}"><i
class='fa fa-times failure-icon'></i>&nbsp;<em>Unsuccessful</em></a>
</td>
<#else>
<td colspan="7"><i
class='fa fa-times failure-icon'></i>&nbsp;<em>Unsuccessful</em></a>
</td>
</#if>
<#else>
<td colspan="3"><a
href="${relativeLink}${brokenReport}"><i
class='fa fa-times failure-icon'></i>&nbsp;<em>Unsuccessful</em></a>
</td>
<#if (resultCounts.getOverallTestsCount("failure","error","compromised") != 0)>
<td colspan="3"><a
href="${relativeLink}${brokenReport}"><i
class='fa fa-times failure-icon'></i>&nbsp;<em>Unsuccessful</em></a>
</td>
<#else>
<td colspan="3"><i
class='fa fa-times failure-icon'></i>&nbsp;<em>Unsuccessful</em></a>
</td>
</#if>
</#if>
</tr>
<tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,15 +350,27 @@
</tr>
<tr>
<#if resultCounts.hasManualTests() >
<td colspan="7"><a
href="${relativeLink}${brokenReport}"><i
class='fa fa-times failure-icon'></i>&nbsp;<em>Unsuccessful</em></a>
</td>
<#if (resultCounts.getOverallTestsCount("failure","error","compromised") != 0)>
<td colspan="7"><a
href="${relativeLink}${brokenReport}"><i
class='fa fa-times failure-icon'></i>&nbsp;<em>Unsuccessful</em></a>
</td>
<#else>
<td colspan="7"><i
class='fa fa-times failure-icon'></i>&nbsp;<em>Unsuccessful</em></a>
</td>
</#if>
<#else>
<td colspan="3"><a
href="${relativeLink}${brokenReport}"><i
class='fa fa-times failure-icon'></i>&nbsp;<em>Unsuccessful</em></a>
</td>
<#if (resultCounts.getOverallTestsCount("failure","error","compromised") != 0)>
<td colspan="3"><a
href="${relativeLink}${brokenReport}"><i
class='fa fa-times failure-icon'></i>&nbsp;<em>Unsuccessful</em></a>
</td>
<#else>
<td colspan="3"><i
class='fa fa-times failure-icon'></i>&nbsp;<em>Unsuccessful</em></a>
</td>
</#if>
</#if>
</tr>
<tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,15 +496,28 @@
</#if>
</tr>
<tr>
<#if resultCounts.hasManualTests() >
<td colspan="7"><a href="${brokenReport}"><i
class='fa fa-times failure-icon'></i>&nbsp;<em>Unsuccessful</em></a>
</td>
<#if resultCounts.hasManualTests() >
<#if (resultCounts.getOverallTestsCount("failure","error","compromised") != 0)>
<td colspan="7"><a href="${brokenReport}"><i
class='fa fa-times failure-icon'></i>&nbsp;<em>Unsuccessful</em></a>
</td>
<#else>
<td colspan="7"><i
class='fa fa-times failure-icon'></i>&nbsp;<em>Unsuccessful</em></a>
</td>
</#if>
<#else>
<td colspan="3"><a href="${brokenReport}"><i
class='fa fa-times failure-icon'></i>&nbsp;<em>Unsuccessful</em></a>
</td>
<#if (resultCounts.getOverallTestsCount("failure","error","compromised") != 0)>
<td colspan="3"><a href="${brokenReport}"><i
class='fa fa-times failure-icon'></i>&nbsp;<em>Unsuccessful</em></a>
</td>
<#else>
<td colspan="3"><i
class='fa fa-times failure-icon'></i>&nbsp;<em>Unsuccessful</em></a>
</td>
</#if>
</#if>
</tr>
<tr>
Expand Down

0 comments on commit 6f66ac3

Please sign in to comment.