[ 
https://issues.apache.org/jira/browse/IGNITE-9645?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16641526#comment-16641526
 ] 

ASF GitHub Bot commented on IGNITE-9645:
----------------------------------------

SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add 
comparison of failed tests lists in two date intervals
URL: https://github.com/apache/ignite-teamcity-bot/pull/25#discussion_r223283252
 
 

 ##########
 File path: ignite-tc-helper-web/src/main/webapp/comparison.html
 ##########
 @@ -173,6 +185,139 @@
         return parseFloat(string.substring(string.indexOf("-") + 2, 
string.lastIndexOf("-") - 1));
     }
 
+    var changeDisplay = function(id) {
+        $("#" + id).toggle();
+    }
+
+    function mergeSuits(results) {
+        let mergedSuites = new Set();
+
+        for (let key of Object.keys(results)) {
+            for (let suite of Object.keys(results[key]))
+                mergedSuites.add(suite);
+        }
+
+        return Array.from(mergedSuites);
+    }
+
+    function printTests(results) {
+        $("#testsTable tr:not(:first-child)").remove();
+
+        let markedRow = true;
+
+        for (let s of mergeSuits(results).sort()) {
+            let suiteName = s.split('_').filter((value, index) => index != 
0).join('_');
+
+            let backgroundColor = markedRow ? "background-color:#fafaff" : '';
+
+            let testsCntCells = '';
+
+            let testsCells = '';
+
+            for (let key of Object.keys(results)) {
+                let obj = results[key];
+
+                let testLength = !obj.hasOwnProperty(s) || obj[s].length == 0 ?
+                    '' : obj[s].length;
+
+                testsCntCells = testsCntCells + '<td title="Click to hide or 
show tests"' +
+                    ' style="cursor: default; text-align: center; 
vertical-align: middle">' +
+                    testLength + '</td>';
+
+                testsCells = testsCells + '<td style="padding: 5px; 
word-wrap:break-word; vertical-align: top">'
+                    + getSuiteTestsHtml(results, s, key) + '</td>'
+            }
+
+            $("#testsTable > tbody:last-child").append('<tr style="'+ 
backgroundColor +
+                '" onclick="changeDisplay(\'' + s + '\')">' +
+                '<td style="padding: 10px; word-wrap:break-word; 
vertical-align: top; padding-left:10px">' + suiteName +
+                '</td><td></td>' + testsCntCells + '</tr>');
+
+            $("#testsTable tbody").append('<tr style="display: none" id="' + s 
+ '">' +
+                '<td></td><td></td>' + testsCells + '</tr>');
+
+            markedRow = !markedRow;
+        }
+    }
+
+    function generateCompareTestsResults(results) {
+        let compareTestsResults = {};
+
+        for (let key of  Object.keys(results)) {
+            let uniqueObj = {};
+
+            for (let suite of  Object.keys(results[key])) {
+                let allTests = [];
+
+                for (let key2 of Object.keys(results)) {
+                    if (key == key2)
+                        continue;
+
+                    allTests = allTests.concat(results[key2][suite]);
+                }
+
+                let uniqTests = results[key][suite].filter(function(test) {
+                    return allTests.indexOf(test) == -1;
+                });
+
+                if (uniqTests.length != 0)
+                    uniqueObj[suite] = uniqTests;
+            }
+
+            compareTestsResults[key] = uniqueObj;
+        }
+
+        return compareTestsResults;
+    }
+
+    function getSuiteTestsHtml(results, suite, key) {
+        if (!results[key].hasOwnProperty(suite) || results[key][suite].length 
== 0)
+            return '';
+
+        let res = '<body><div  id="' + suite + key + '"style="cursor: default; 
margin-left: 10px;">';
+
+        for (let v of results[key][suite].sort()) {
+            let list = v.toString().split(".");
+
+            if (list.length < 2)
+                list = v.toString().split(":");
+
+            let testName = list.pop();
+
 
 Review comment:
   Remove empty line between `let` statements.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> [TC Bot] Add comparison of failed tests lists in two date intervals
> -------------------------------------------------------------------
>
>                 Key: IGNITE-9645
>                 URL: https://issues.apache.org/jira/browse/IGNITE-9645
>             Project: Ignite
>          Issue Type: Task
>            Reporter: PetrovMikhail
>            Assignee: PetrovMikhail
>            Priority: Major
>
> Based on [IGNITE-9541|https://issues.apache.org/jira/browse/IGNITE-9541] It's 
> needed to add comparison of failed tests lists in two date intervals



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to