in ignite-tc-helper-web/src/main/webapp/js/testfails-2.2.js [846:1047]
function showTestFailData(testFail, isFailureShown, settings) {
var failRateDefined =
isDefinedAndFilled(testFail.histBaseBranch)
&& isDefinedAndFilled(testFail.histBaseBranch.recent)
&& isDefinedAndFilled(testFail.histBaseBranch.recent.failureRate);
var failRate = failRateDefined ? testFail.histBaseBranch.recent.failureRate : null;
var flakyCommentsInBase =
isDefinedAndFilled(testFail.histBaseBranch) && isDefinedAndFilled(testFail.histBaseBranch.flakyComments)
? testFail.histBaseBranch.flakyComments
: null;
let shownBecauseOfDuration = (isDefinedAndFilled(testFail.success) && testFail.success === true) || !isFailureShown;
if (!shownBecauseOfDuration) {
if (failRate != null) {
if (parseFloat(failRate) < settings.minFailRate)
return ""; //test is hidden
if (parseFloat(failRate) > settings.maxFailRate)
return ""; //test is hidden
}
if (flakyCommentsInBase != null && settings.hideFlakyFailures)
return ""; // test is hidden
}
var res = "<tr><td align='right' valign='top' colspan='2' width='10%'>";
var haveIssue = isDefinedAndFilled(testFail.webIssueUrl) && isDefinedAndFilled(testFail.webIssueText);
var color;
if (testFail.success === true) {
color = "green";
} else {
color = (isFailureShown && failRateDefined)
? failureRateToColor(failRate)
: "white";
}
var investigated = isDefinedAndFilled(testFail.investigated) && testFail.investigated;
if (investigated) {
res += "<img src='https://d30y9cdsu7xlg0.cloudfront.net/png/324212-200.png' width=11px height=11px> ";
res += "<span style='opacity: 0.75'> ";
}
// has both base and current, draw current latest runs here.
var comparePage =
findGetParameter('action') != null
|| (
isDefinedAndFilled(testFail.histCurBranch) && isDefinedAndFilled(testFail.histCurBranch.latestRuns)
&& isDefinedAndFilled(testFail.histBaseBranch) && isDefinedAndFilled(testFail.histBaseBranch.latestRuns)
);
var baseBranchMarks = "";
if (isFailureShown && flakyCommentsInBase != null) {
baseBranchMarks += "<span title='" + flakyCommentsInBase + "' style=\"color: #303030; font-size: 125%;\">" + "⚂" + "</span> "; //≈
}
if (comparePage) {
var flakyCommentsInCur =
isDefinedAndFilled(testFail.histCurBranch) && isDefinedAndFilled(testFail.histCurBranch.flakyComments)
? testFail.histCurBranch.flakyComments
: null;
if(flakyCommentsInCur!=null)
res += "<span title='" + flakyCommentsInCur + "' style=\"color: #303030; font-size: 125%;\">" + "⚂" + "</span> "; //≈
}
else {
res += baseBranchMarks;
}
if (isDefinedAndFilled(testFail.blockerComment) && testFail.blockerComment !== "") {
res += "<span title='" + testFail.blockerComment + "'> 🚫</span> "
}
var bold = false;
if(isFailureShown && isDefinedAndFilled(testFail.problemRef)) {
res += "<span title='"+testFail.problemRef.name +"'>🐞</span>";
if(!bold)
res += "<b>";
bold = true;
}
var haveWeb = isDefinedAndFilled(testFail.webUrl);
if (haveWeb)
res += "<a href='" + testFail.webUrl + "'>";
if(comparePage) {
if (isDefinedAndFilled(testFail.histCurBranch))
res += drawLatestRuns(testFail.histCurBranch.latestRuns);
} else if(isDefinedAndFilled(testFail.histBaseBranch) && isDefinedAndFilled(testFail.histBaseBranch.latestRuns))
res += drawLatestRuns(testFail.histBaseBranch.latestRuns); // has only base branch
if (haveWeb)
res += "</a> ";
res += "</td><td valign='top'>";
res += "<span style='background-color: " + color + "; width:8px; height:8px; display: inline-block; border-width: 1px; border-color: black; border-style: solid; '></span> ";
if (isDefinedAndFilled(testFail.curFailures) && testFail.curFailures > 1)
res += "[" + testFail.curFailures + "] ";
if (haveIssue) {
res += "<a href='" + testFail.webIssueUrl + "'>";
res += testFail.webIssueText;
res += "</a>";
res += ": ";
}
if (isDefinedAndFilled(testFail.suiteName) && isDefinedAndFilled(testFail.testName))
res += "<font color='grey'>" + testFail.suiteName + ":</font> " + testFail.testName;
else
res += testFail.name;
var histContent = "";
//see class TestHistory
var hist;
if(isDefinedAndFilled(testFail.histBaseBranch))
hist = testFail.histBaseBranch;
else
hist = null;
if (isFailureShown && hist!=null) {
if(comparePage) {
histContent += baseBranchMarks + " ";
}
var testFailTitle = "";
if(isDefinedAndFilled(hist.recent) && isDefinedAndFilled(hist.recent.failures))
testFailTitle = "recent rate: " + hist.recent.failures + " fails / " + hist.recent.runs + " runs" ;
histContent += " <span title='" +testFailTitle + "'>";
if (isDefinedAndFilled(hist.recent) && isDefinedAndFilled(hist.recent.failureRate))
histContent += "(fail rate " + hist.recent.failureRate + "%)";
else
histContent += "(no data)";
histContent += "</span>";
if(comparePage && isDefinedAndFilled(testFail.histBaseBranch) && isDefinedAndFilled(testFail.histBaseBranch.latestRuns)) {
histContent += " " + drawLatestRuns(testFail.histBaseBranch.latestRuns); // has both base and current, draw current base runs here.
}
} else if (haveWeb) {
histContent += " (test history)";
}
if (shownBecauseOfDuration && isDefinedAndFilled(testFail.durationPrintable))
res += " duration " + testFail.durationPrintable;
if (bold)
res += "</b>";
if (investigated)
res += "</span> ";
if (isDefinedAndFilled(testFail.warnings) && testFail.warnings.length > 0
&& !isDefinedAndFilled(findGetParameter("reportMode"))) {
res += "<span class='container'>";
res += " <a href='javascript:void(0);' class='header'>" + more + "</a>";
res += "<div class='content'>";
res += "<p class='logMsg'>";
for (var i = 0; i < testFail.warnings.length; i++) {
res += " ";
res += " ";
res += testFail.warnings[i];
res += " <br>";
}
res += "</p>";
res += "</div></span>";
}
res += "<td width='25%'>";
var haveBaseBranchWeb = isDefinedAndFilled(testFail.webUrlBaseBranch);
if (haveBaseBranchWeb)
res += "<a href='" + testFail.webUrlBaseBranch + "'>";
res += histContent;
if (haveBaseBranchWeb)
res += "</a>";
res += " </td>";
res += "</td></tr>";
return res;
}