Skip to content

Commit

Permalink
Merge pull request #697 from bppdanto-t/add-theme-toggle
Browse files Browse the repository at this point in the history
Add theme toggle in HTML report
  • Loading branch information
authorjapps authored Nov 29, 2024
2 parents 739dd2b + 2ddaa2d commit c86bb83
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,9 @@ public interface ZeroCodeReportConstants {
String ZEROCODE_JUNIT = "zerocode.junit";
String CHARTS_AND_CSV = "gen-smart-charts-csv-reports";

// Custom js and css for extent report
String EXTENT_ADDITIONAL_JS = "document.querySelector('.vheader').insertAdjacentHTML('afterbegin'," +
"'<div id=\"theme-selector\"class=\"nav-right\"onClick=$(\"body\").toggleClass(\"dark\")>" +
"<span class=\"badge badge-primary\"><i class=\"fa fa-desktop\"></i></span></div>')";
String EXTENT_ADDITIONAL_CSS = "#theme-selector{padding-right:12px;padding-left:12px;margin-right:10px}";
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import java.util.Properties;
import java.util.Set;

import static org.jsmart.zerocode.core.constants.ZeroCodeReportConstants.EXTENT_ADDITIONAL_CSS;
import static org.jsmart.zerocode.core.constants.ZeroCodeReportConstants.EXTENT_ADDITIONAL_JS;
import static org.jsmart.zerocode.core.constants.ZeroCodeReportConstants.REPORT_DISPLAY_NAME_DEFAULT;
import static org.jsmart.zerocode.core.constants.ZeroCodeReportConstants.REPORT_TITLE_DEFAULT;
import static org.slf4j.LoggerFactory.getLogger;
Expand Down Expand Up @@ -56,7 +58,8 @@ public static void attachSystemInfo() {
public static ExtentSparkReporter createExtentHtmlReporter(String reportFileName) {
extentSparkReporter = new ExtentSparkReporter(reportFileName);


extentSparkReporter.config().setJs(EXTENT_ADDITIONAL_JS);
extentSparkReporter.config().setCss(EXTENT_ADDITIONAL_CSS);
extentSparkReporter.config().setDocumentTitle(REPORT_TITLE_DEFAULT);
extentSparkReporter.config().setReportName(REPORT_DISPLAY_NAME_DEFAULT);

Expand Down

0 comments on commit c86bb83

Please sign in to comment.