Skip to content

Commit

Permalink
closes #157
Browse files Browse the repository at this point in the history
  • Loading branch information
anshooarora committed Jun 9, 2020
1 parent d369e46 commit 4bda536
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.aventstack.extentreports;

import java.util.Calendar;
import java.util.List;

import com.aventstack.extentreports.model.Author;
Expand Down Expand Up @@ -44,8 +45,8 @@ protected void onNodeRemoved(Test node) {
protected void onLogCreated(Log log, Test test) {
super.onLogCreated(log, test);
log.getExceptions().stream()
.filter(x -> x.getException() != null)
.forEach(x -> getReport().getExceptionInfoCtx().addContext(x, test));
.filter(x -> x.getException() != null)
.forEach(x -> getReport().getExceptionInfoCtx().addContext(x, test));
}

@Override
Expand Down Expand Up @@ -82,6 +83,7 @@ protected void onFlush() {
categoryCtx.getSet().forEach(x -> x.refresh());
deviceCtx.getSet().forEach(x -> x.refresh());
ReportStatsService.refreshReportStats(getReport().getStats(), testList);
getReport().setEndTime(Calendar.getInstance().getTime());
super.onFlush();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
*/
@Getter
public class GherkinKeyword {

private static final Logger logger = Logger.getLogger(GherkinKeyword.class.getName());

private Class<IGherkinFormatterModel> clazz = IGherkinFormatterModel.class;
Expand All @@ -60,7 +59,6 @@ public GherkinKeyword(String gk) throws ClassNotFoundException {
&& !dialect.getLanguage().equalsIgnoreCase(GherkinDialectManager.getDefaultLanguage())) {
apiKeyword = null;
Map<String, List<String>> keywords = dialect.getKeywords();

for (Entry<String, List<String>> key : keywords.entrySet()) {
apiKeyword = key.getValue().stream()
.filter(x -> x.trim().equalsIgnoreCase(gk.trim()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.util.Map;

import lombok.Getter;
import lombok.ToString;

/**
* <p>
Expand All @@ -15,6 +16,7 @@
*
*/
@Getter
@ToString
public class GherkinDialect {
private final Map<String, List<String>> keywords;
private String language;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,8 @@ public void removeTest(Test test) {
public boolean hasItems() {
return !set.isEmpty();
}

public void resetAll() {
set.stream().forEach(x -> x.refresh());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ public static Report filter(Report report, Set<Status> statusList) {
if (report.getTestList().isEmpty())
return report;
Report filtered = Report.builder().build();
filtered.getLogs().addAll(report.getLogs());
filtered.setStartTime(report.getStartTime());
filtered.setEndTime(report.getEndTime());
List<Test> list = report.getTestList().stream()
.filter(x -> statusList.contains(x.getStatus()))
.collect(Collectors.toList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class AbstractFilterableReporter extends AbstractReporter implements Stat
@Override
public Report filterAndGet(Report report, Set<Status> set) {
if (report == null || report.getTestList().isEmpty())
return Report.builder().build();
return report;
if (set != null)
return ReportFilterService.filter(report, set);
return report;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class ExtentSparkReporter extends AbstractFileReporter implements ReportO
private static final String SPA_TEMPLATE_NAME = REPORTER_NAME + "/spark.spa.ftl";
private static final String FILE_NAME = "Index.html";
private static final List<ViewName> SUPPORTED_VIEWS = Arrays.asList(new ViewName[]{
ViewName.CATEGORY, ViewName.DASHBOARD, ViewName.EXCEPTION, ViewName.TEST
ViewName.CATEGORY, ViewName.DASHBOARD, ViewName.EXCEPTION, ViewName.TEST, ViewName.LOG
});

private final ExtentSparkReporterConfig config = new ExtentSparkReporterConfig(this);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.aventstack.extentreports.reporter.configuration;

public enum ViewName {
AUTHOR, CATEGORY, DASHBOARD, DEVICE, EXCEPTION, LOGS, TEST;
AUTHOR, CATEGORY, DASHBOARD, DEVICE, EXCEPTION, LOG, TEST;

@Override
public String toString() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class ViewOrder {
ViewName.CATEGORY,
ViewName.DEVICE,
ViewName.AUTHOR,
ViewName.LOGS,
ViewName.LOG,
ViewName.DASHBOARD
});

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<div class="test-wrapper row view log-view">
<div class="col-md-12 mt-3">
<div class="card"><div class="card-body">
<#list report.logs as log>${ log }</#list>
</div></div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
|| order.toString()=="category" && report.categoryCtx.hasItems()
|| order.toString()=="device" && report.deviceCtx.hasItems()
|| order.toString()=="author" && report.authorCtx.hasItems()
|| order.toString()=="test" || order.toString()=="dashboard">
<#assign ico="align-left">
|| order.toString()=="test" || order.toString()=="dashboard" || order.toString()=="log">
<#assign ico="list">
<#if order.toString()=="category"><#assign ico="tag">
<#elseif order.toString()=="exception"><#assign ico="bug">
<#elseif order.toString()=="device"><#assign ico="tablet">
<#elseif order.toString()=="author"><#assign ico="user">
<#elseif order.toString()=="dashboard"><#assign ico="bar-chart">
<#elseif order.toString()=="log"><#assign ico="clipboard">
</#if>
<li class="nav-item dropdown" onclick="toggleView('${order.toString()}-view')">
<a id="nav-${order.toString()}" class="dropdown-toggle" href="#">
Expand Down

0 comments on commit 4bda536

Please sign in to comment.