From d5dda903d18c3cc86e55b2b99dfe6db0ceba8574 Mon Sep 17 00:00:00 2001 From: Mohammad Saddam Hossain Date: Tue, 27 Oct 2026 09:56:54 +0530 Subject: [PATCH] fix(report): readable timeline lane labels Lanes are TestNG threads named TestNG-test--; the shared prefix filled the 130px column and ellipsised away the part that tells lanes apart. Drop the prefix in the label (full name stays in the tooltip) and widen the column to 170px. Co-Authored-By: Claude Sonnet 5.5 --- .../seleniumboot/reporting/HtmlReportGenerator.java | 8 +++++++- src/main/resources/report/report.css | 2 +- .../com/seleniumboot/unit/TimelineReportTest.java | 13 +++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/seleniumboot/reporting/HtmlReportGenerator.java b/src/main/java/com/seleniumboot/reporting/HtmlReportGenerator.java index 241d2c2..0e79d58 100644 --- a/src/main/java/com/seleniumboot/reporting/HtmlReportGenerator.java +++ b/src/main/java/com/seleniumboot/reporting/HtmlReportGenerator.java @@ -854,7 +854,7 @@ static String buildTimelineSection(JsonNode tests) { for (java.util.Map.Entry> lane : lanes.entrySet()) { sb.append("
") .append("
") - .append(escapeHtml(lane.getKey())).append("
") + .append(escapeHtml(timelineLaneLabel(lane.getKey()))).append("
") .append("
"); for (TimelineEntry e : lane.getValue()) { @@ -885,6 +885,12 @@ static String buildTimelineSection(JsonNode tests) { return sb.toString(); } + /** Drops TestNG's shared "TestNG-test-" thread prefix so the distinguishing part of the name fits the lane. */ + static String timelineLaneLabel(String thread) { + return thread.startsWith("TestNG-test-") && thread.length() > "TestNG-test-".length() + ? thread.substring("TestNG-test-".length()) : thread; + } + private static String timelineStatusSlug(String status) { if (status == null) return "unknown"; switch (status.toUpperCase(java.util.Locale.ROOT)) { diff --git a/src/main/resources/report/report.css b/src/main/resources/report/report.css index d4d96bc..0c933d0 100644 --- a/src/main/resources/report/report.css +++ b/src/main/resources/report/report.css @@ -169,7 +169,7 @@ .timeline-legend { display: inline-flex; align-items: center; gap: 12px; font-size: 11px; font-weight: 500; color: var(--text-secondary); } .gantt-wrap { overflow-x: auto; } .gantt { min-width: 640px; padding: 4px 0; } - .gantt-row { display: grid; grid-template-columns: 130px 1fr; align-items: center; } + .gantt-row { display: grid; grid-template-columns: 170px 1fr; align-items: center; } .gantt-axis-row { margin-bottom: 6px; } .gantt-lane-name { font-size: 12px; color: var(--text-secondary); padding-right: 12px; diff --git a/src/test/java/com/seleniumboot/unit/TimelineReportTest.java b/src/test/java/com/seleniumboot/unit/TimelineReportTest.java index c1a6d14..4f02b72 100644 --- a/src/test/java/com/seleniumboot/unit/TimelineReportTest.java +++ b/src/test/java/com/seleniumboot/unit/TimelineReportTest.java @@ -31,6 +31,19 @@ private static int count(String haystack, String needle) { return count; } + @Test + public void laneLabelDropsSharedTestNgThreadPrefixButKeepsFullNameInTitle() throws Exception { + String html = timeline(""" + [ + {"testId":"com.x.A.one","thread":"TestNG-test-StorageDemo-3","status":"PASSED", + "totalMs":100,"startedAtMs":1000} + ] + """); + + Assert.assertTrue(html.contains(">StorageDemo-3
"), html); + Assert.assertTrue(html.contains("title=\"TestNG-test-StorageDemo-3\""), html); + } + @Test public void rendersOneLanePerThreadUsingStartedAtMs() throws Exception { String html = timeline("""