@@ -22,28 +22,59 @@ fun getFailuresReport(
2222 failureEntries : List <FailureEntry >,
2323 reportsDir : File ,
2424): String {
25+
26+ val failureLogs = failureEntries.filter { it.failure.name.endsWith(" .txt" ) }
27+ val failureImages = failureEntries.filter { it.failure.name.endsWith(" .png" ) }
28+
2529 return buildString {
26- append(" <h3 >Failures Report</h3 >" )
30+ append(" <h2 >Failures Report</h2 >" )
2731 val fileNameClass = " flow-text col s3"
2832 val fileNameStyle = " word-wrap: break-word; word-break: break-all;"
29- val imgClass = " col s3"
33+ val txtClass = " col s3"
34+ val imgClass = " col s9"
3035 val imgAttributes = " style=\" width: 100%; height: 100%; object-fit: cover;\" class=\" modal-trigger\" "
36+ append(" <h3>Logs</h3>" )
37+ append(" <table class=\" highlight\" id=\"\" >" )
38+ append(" <thead>" )
39+ append(" <tr class=\" row\" >" )
40+ append(" <th class=\" $fileNameClass \" style=\" $fileNameStyle \" >File Name</th>" )
41+ append(" <th class=\" $txtClass flow-text \" >Golden Log</th>" )
42+ append(" <th class=\" $txtClass flow-text \" >Failure</th>" )
43+ append(" <th class=\" $txtClass flow-text \" >Recorded Log</th>" )
44+ append(" </tr>" )
45+ append(" </thead>" )
46+ append(" <tbody>" )
47+ failureLogs.forEach { entry ->
48+ append(" <tr class=\" row\" >" )
49+ append(" <td class=\" $fileNameClass \" style=\" $fileNameStyle \" >${entry.failure.name} </td>" )
50+ append(" <td class=\" $txtClass \" ><iframe $imgAttributes src=\" ${entry.golden.relativeTo(reportsDir)} \" ></iframe></td>" )
51+ append(" <td class=\" $txtClass \" ><iframe $imgAttributes src=\" ${entry.failure.relativeTo(reportsDir)} \" ></iframe></td>" )
52+ append(" <td class=\" $txtClass \" ><iframe $imgAttributes src=\" ${entry.recorded.relativeTo(reportsDir)} \" ></iframe></td>" )
53+ append(" </tr>" )
54+ }
55+ append(" </tbody>" )
56+ append(" </table>" )
57+ append(" <br>" )
58+
59+ append(" <h3>Screenshots</h3>" )
3160 append(" <table class=\" highlight\" id=\"\" >" )
3261 append(" <thead>" )
3362 append(" <tr class=\" row\" >" )
3463 append(" <th class=\" $fileNameClass \" style=\" $fileNameStyle \" >File Name</th>" )
35- append(" <th class=\" $imgClass flow-text \" >Golden Log </th>" )
36- append(" <th class=\" $imgClass flow-text \" >Failure </th>" )
37- append(" <th class=\" $imgClass flow-text \" >Recorded Log </th>" )
64+ append(" <th class=\" $txtClass flow-text \" >Golden</th>" )
65+ append(" <th class=\" $txtClass flow-text \" >Diff </th>" )
66+ append(" <th class=\" $txtClass flow-text \" >Recorded</th>" )
3867 append(" </tr>" )
3968 append(" </thead>" )
4069 append(" <tbody>" )
41- failureEntries .forEach { entry ->
70+ failureImages .forEach { entry ->
4271 append(" <tr class=\" row\" >" )
4372 append(" <td class=\" $fileNameClass \" style=\" $fileNameStyle \" >${entry.failure.name} </td>" )
44- append(" <td class=\" $imgClass \" ><iframe $imgAttributes src=\" ${entry.golden.relativeTo(reportsDir)} \" ></iframe></td>" )
45- append(" <td class=\" $imgClass \" ><iframe $imgAttributes src=\" ${entry.failure.relativeTo(reportsDir)} \" ></iframe></td>" )
46- append(" <td class=\" $imgClass \" ><iframe $imgAttributes src=\" ${entry.recorded.relativeTo(reportsDir)} \" ></iframe></td>" )
73+ append(
74+ " <td class=\" $imgClass \" ><a href=\" ${entry.failure.relativeTo(reportsDir)} \" target=\" _blank\" ><img $imgAttributes src=\" ${
75+ entry.failure.relativeTo(reportsDir)
76+ } \" /></a></td>"
77+ )
4778 append(" </tr>" )
4879 }
4980 append(" </tbody>" )
@@ -56,23 +87,33 @@ fun getRecordedReport(
5687 reportsDir : File ,
5788): String {
5889 return buildString {
59- append(" <h3>Recorded Logs Report</h3>" )
90+ append(" <h3>Recorded Report</h3>" )
6091 val fileNameClass = " flow-text col s3"
6192 val fileNameStyle = " word-wrap: break-word; word-break: break-all;"
62- val imgClass = " col s9"
93+ val txtClass = " col s9"
94+ val imgClass = " col s3"
6395 val imgAttributes = " style=\" width: 100%; height: 100%; object-fit: cover;\" class=\" modal-trigger\" "
6496 append(" <table class=\" highlight\" id=\"\" >" )
6597 append(" <thead>" )
6698 append(" <tr class=\" row\" >" )
6799 append(" <th class=\" $fileNameClass \" style=\" $fileNameStyle \" >File Name</th>" )
68- append(" <th class=\" $imgClass flow-text \" >Recorded Log </th>" )
100+ append(" <th class=\" $txtClass flow-text \" >Recorded</th>" )
69101 append(" </tr>" )
70102 append(" </thead>" )
71103 append(" <tbody>" )
72104 recordedFiles.forEach { recorded ->
73105 append(" <tr class=\" row\" >" )
74- append(" <td class=\" $fileNameClass \" style=\" $fileNameStyle \" >${recorded.name} </td>" )
75- append(" <td class=\" $imgClass \" ><iframe $imgAttributes src=\" ${recorded.relativeTo(reportsDir)} \" ></iframe></td>" )
106+ if (recorded.name.substringAfterLast(" ." ) == " txt" ) {
107+ append(" <td class=\" $fileNameClass \" style=\" $fileNameStyle \" >${recorded.name} </td>" )
108+ append(" <td class=\" $txtClass \" ><iframe $imgAttributes src=\" ${recorded.relativeTo(reportsDir)} \" ></iframe></td>" )
109+ } else {
110+ append(" <td class=\" $fileNameClass \" style=\" $fileNameStyle \" >${recorded.name} </td>" )
111+ append(
112+ " <td class=\" $imgClass \" ><a href=\" ${recorded.relativeTo(reportsDir)} \" target=\" _blank\" ><img $imgAttributes src=\" ${
113+ recorded.relativeTo(reportsDir)
114+ } \" /></a></td>"
115+ )
116+ }
76117 append(" </tr>" )
77118 }
78119 append(" </tbody>" )
0 commit comments