Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ static String buildTimelineSection(JsonNode tests) {
for (java.util.Map.Entry<String, java.util.List<TimelineEntry>> lane : lanes.entrySet()) {
sb.append(" <div class=\"gantt-row gantt-lane\">")
.append("<div class=\"gantt-lane-name\" title=\"").append(escapeHtml(lane.getKey())).append("\">")
.append(escapeHtml(lane.getKey())).append("</div>")
.append(escapeHtml(timelineLaneLabel(lane.getKey()))).append("</div>")
.append("<div class=\"gantt-track\">");

for (TimelineEntry e : lane.getValue()) {
Expand Down Expand Up @@ -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)) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/report/report.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
13 changes: 13 additions & 0 deletions src/test/java/com/seleniumboot/unit/TimelineReportTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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</div>"), html);
Assert.assertTrue(html.contains("title=\"TestNG-test-StorageDemo-3\""), html);
}

@Test
public void rendersOneLanePerThreadUsingStartedAtMs() throws Exception {
String html = timeline("""
Expand Down
Loading