Skip to content

Commit 410dc6a

Browse files
authored
Merge pull request #47 from edcdavid/add-collapsible-log-output
Add Collapsible Test output
2 parents de20b03 + 6a40006 commit 410dc6a

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

html/index.js

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -355,16 +355,14 @@ function generateTestcaseSingleResultElement (currentTestResult, tableName, id,
355355
const headingid = 'heading' + id
356356

357357
commonTestTextContent += '<rh-accordion-header id="' + headingid + '" data-id="' + testStatus + '" data-bs-target="#' +
358-
itemid + '" aria-expanded="true"><div class=tag-header><h1 class="test-header">' + currentTestResult.testID.id + buttontype + '</h1></rh-accordion-header>'
358+
itemid + '" aria-expanded="true"><div class=tag-header><h1 class="test-header">' + currentTestResult.testID.id + buttontype + '</h1></div></rh-accordion-header>'
359359
commonTestTextContent += '<rh-accordion-panel id="' + itemid + '"aria-labelledby="' + headingid + '>'
360360
commonTestTextContent += '<div class="table-responsive">'
361361
commonTestTextContent += '<h1 class="test-section">Results</h1>'
362-
commonTestTextContent += '<table id="myTable-' + currentTestResult.testID.id + '" class="table table-bordered"><thead><tr>'
363-
commonTestTextContent += '<th>Test ID</th>'
364-
commonTestTextContent += '<th class="th-lg">Test Text</th>'
362+
commonTestTextContent += '<rh-table><table id="myTable-' + currentTestResult.testID.id + '" class="table table-bordered"><thead><tr>'
363+
commonTestTextContent += '<th>Test Description</th>'
365364
commonTestTextContent += '<th>Duration</th>'
366365
commonTestTextContent += '<th>State</th>'
367-
commonTestTextContent += '<th>Test output</th>'
368366
commonTestTextContent += '</tr></thead><tbody>'
369367

370368
dayjs.extend(window.dayjs_plugin_duration)
@@ -378,15 +376,13 @@ function generateTestcaseSingleResultElement (currentTestResult, tableName, id,
378376
}
379377
skippedReason = ' ( ' + skippedReason + ' )'
380378
}
381-
commonTestTextContent += '<tr><td style="white-space: nowrap;">' + currentTestResult.testID.id + '</td>'
382-
commonTestTextContent += '<td class="th-lg">' + currentTestResult.catalogInfo.description.replace(/\n/g, '<br>') + '</td>'
379+
commonTestTextContent += '<td>' + currentTestResult.catalogInfo.description.replace(/\n/g, '<br>') + '</td>'
383380
commonTestTextContent += '<td>' + formattedDuration + '</td>'
384381
commonTestTextContent += '<td><b>' + currentTestResult.state + '</b>' + skippedReason + '</td>'
385-
commonTestTextContent += '<td>' + ansiUp.ansi_to_html(currentTestResult.capturedTestOutput).replace(/\n/g, '<br>') + '</td></tr>'
382+
commonTestTextContent += '</tbody></table></rh-table></div>'
386383
const jsonObjNonCompliant = NonCompliantReasonTextToJson(currentTestResult.checkDetails)
387384
const jsonObjCompliant = CompliantReasonTextToJson(currentTestResult.checkDetails)
388-
389-
commonTestTextContent += '</tbody></table></div>'
385+
const logOutput = ansiUp.ansi_to_html(currentTestResult.capturedTestOutput).replace(/\n/g, '<br>')
390386

391387
commonTestTextContent += '<h1 class="test-section">Feedback</h1><label>Write your feedback for ' + currentTestResult.testID.id + ' test case</label>'
392388
commonTestTextContent += '<textarea style="width: 100%; margin: 0 auto;" rows = "5" id="source-' + tableName + '-' + currentTestResult.testID.id + '" type="text"></textarea>'
@@ -395,6 +391,15 @@ function generateTestcaseSingleResultElement (currentTestResult, tableName, id,
395391
commonTestTextContent += createReasonTableAllTypes(jsonObjNonCompliant)
396392
commonTestTextContent += '<h1 class="test-section">Compliant objects</h1>'
397393
commonTestTextContent += createReasonTableAllTypes(jsonObjCompliant)
394+
395+
// Collapsible test output
396+
commonTestTextContent += '<rh-accordion class="rh-accordion" id="output-accordion">'
397+
commonTestTextContent += '<rh-accordion-header aria-expanded="true"><h1 class="test-header"> Test Output</h1></rh-accordion-header>'
398+
commonTestTextContent += '<rh-accordion-panel>'
399+
commonTestTextContent += '<div style="width: 100%; margin: 0 auto;">' + logOutput + '</div>'
400+
commonTestTextContent += '</rh-accordion-panel></rh-accordion >'
401+
402+
// Close main accordion
398403
commonTestTextContent += '</rh-accordion-panel>'
399404

400405
return commonTestTextContent

0 commit comments

Comments
 (0)