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("""