OLD | NEW |
---|---|
1 <!-- | 1 <!-- |
2 Copyright 2014 The Chromium Authors. All rights reserved. | 2 Copyright 2014 The Chromium Authors. All rights reserved. |
3 Use of this source code is governed by a BSD-style license that can be | 3 Use of this source code is governed by a BSD-style license that can be |
4 found in the LICENSE file. | 4 found in the LICENSE file. |
5 --> | 5 --> |
6 | 6 |
7 <link rel="import" href="../bower_components/paper-icon-button/paper-icon-button .html"> | |
8 | |
7 <polymer-element name="ct-test-list" attributes="tests tree"> | 9 <polymer-element name="ct-test-list" attributes="tests tree"> |
8 <template> | 10 <template> |
9 <style> | 11 <style> |
10 :host { | 12 :host { |
11 display: block; | 13 display: block; |
12 } | 14 } |
15 | |
16 paper-icon-button { | |
17 vertical-align: middle; | |
18 } | |
13 </style> | 19 </style> |
14 <template repeat="{{ test in tests }}"> | 20 <template repeat="{{ groups in testGroups_ }}"> |
15 <!-- FIXME: Find a less redundant UI than repeating the step on each line. --> | 21 <!-- FIXME: Find a less redundant UI than repeating the step on each line. --> |
16 <div> | 22 <template repeat="{{ group in groups.tests }}"> |
17 {{ test.step }} | 23 <!-- Case 1: entire step failed --> |
18 <template if="{{ test.testName }}"><a href="{{ test | flakinessDashboard URL }}">{{ test.testName }}</a></template> | 24 <template if="{{ !group.name }}"> |
19 <template if="{{ !test.testName }}"><b>whole step failed</b></template> | 25 <div>{{groups.step}} <b>whole step failed</b></div> |
20 </div> | 26 </template> |
27 <!-- Case 2: single test failure --> | |
28 <template if="{{ group.name && (group.tests.length == 1 || group.expande d) }}"> | |
29 <template repeat="{{test in group.tests}}"> | |
30 <div> | |
31 {{ groups.step }} | |
32 <a href="{{ test | flakinessDashboardURL }}">{{ test.testName }}</ a> | |
33 </div> | |
34 </template> | |
35 </template> | |
36 <!-- Case 3: group of tests failed --> | |
37 <template if="{{ group.name && group.tests.length > 1 && !group.expanded }}"> | |
ojan
2014/08/11 02:18:55
Here and below, put spaces after {{ and before }}.
jochen (gone - plz use gerrit)
2014/08/11 12:59:36
done
| |
38 <div> | |
39 {{ groups.step }} {{ group.name }} ({{ group.tests.length }} Tests) | |
40 <paper-icon-button id="expand" icon="more-vert" step="{{groups.step} }" group="{{group.name}}" on-click="{{ _expand }}"></paper-icon-button> | |
41 </div> | |
42 </template> | |
43 </template> | |
21 </template> | 44 </template> |
22 </template> | 45 </template> |
23 <script> | 46 <script> |
24 Polymer({ | 47 Polymer('ct-test-list', { |
48 testsChanged: function() { | |
49 var groups = {}; | |
50 if (this.tests) { | |
51 this.tests.forEach(function(test) { | |
52 if (!groups[test.step]) | |
53 groups[test.step] = {}; | |
54 var testName = this._nameForTest(test); | |
ojan
2014/08/11 02:18:56
How about if we put a method reasonGroupName on CT
jochen (gone - plz use gerrit)
2014/08/11 12:59:36
added the method to CTFailure
| |
55 if (!groups[test.step][testName]) | |
56 groups[test.step][testName] = []; | |
57 groups[test.step][testName].push(test); | |
58 }.bind(this)); | |
59 } | |
60 this.testGroups_ = []; | |
61 Object.keys(groups, function(step, testsByName) { | |
62 var tests = []; | |
63 Object.keys(testsByName, function(name, testList) { | |
64 if (name == 'undefined') | |
65 name = undefined; | |
66 tests.push({'name': name, 'tests': testList, 'expanded': false}); | |
67 }.bind(this)); | |
68 this.testGroups_.push({'step': step, 'tests': tests}); | |
ojan
2014/08/11 02:18:56
this.testGroups_ should be sorted by step and test
jochen (gone - plz use gerrit)
2014/08/11 12:59:36
Done
| |
69 }.bind(this)); | |
70 }, | |
71 | |
72 _nameForTest: function(test) { | |
73 if (!test.testName) | |
74 return undefined; | |
75 if (test.step == 'blink') | |
ojan
2014/08/11 02:18:56
Shouldn't this be webkit_tests?
jochen (gone - plz use gerrit)
2014/08/11 12:59:36
done
| |
76 return test.testName.substr(0, test.testName.lastIndexOf('/')); | |
ojan
2014/08/11 02:18:56
We'll probably want to have more complicated group
| |
77 return test.testName.substr(0, test.testName.lastIndexOf('.')); | |
78 }, | |
79 | |
80 _expand: function(evt) { | |
81 step = evt.target.attributes['step'].value; | |
82 name = evt.target.attributes['group'].value; | |
83 this.testGroups_.forEach(function(testGroup) { | |
84 if (testGroup.step == step) { | |
85 testGroup.tests.forEach(function(test) { | |
86 if (test.name == name) | |
87 test.expanded = true; | |
88 }); | |
89 } | |
90 }); | |
91 }, | |
92 | |
25 flakinessDashboardURL: function(test) { | 93 flakinessDashboardURL: function(test) { |
26 return ui.urlForFlakinessDashboard(test.testName, test.step, this.tree); | 94 return ui.urlForFlakinessDashboard(test.testName, test.step, this.tree); |
27 }, | 95 }, |
28 }); | 96 }); |
29 </script> | 97 </script> |
30 </polymer-element> | 98 </polymer-element> |
OLD | NEW |